Closed scaery closed 3 years ago
Went through a second time with the instructions above and all got well ;)
PLAY RECAP ************************************************************************************************************************************************************
10.101.101.12 : ok=37 changed=23 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
10.101.101.14 : ok=29 changed=21 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
10.101.101.18 : ok=25 changed=23 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
10.101.101.20 : ok=40 changed=25 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Pre-instructions and documentation improvements for building Detection Lab on OSX:
brew install sshpass
vagrant plugin install vagrant-reload
sudo launchctl limit maxfiles 9655360 999900000
env no_proxy='*' ansible-playbook -vvv detectionlab.yml -f1
Post-Instructions for Copy&Paste via Remote Console (advanced parameters in VMX template):
isolation.tools.copy.disable FALSE
isolation.tools.paste.disable FALSE
isolation.tools.setGUIOptions.enable TRUE
Maybe now its time for more improvements, e.g. a build script to decide whether 2 or 3 NICs for building.
Curious how you got the Packer portion of the Lab built since VNC is no longer an option in 6.7/7.0.
If you want, you can either build on Vagrant, convert to ovf 1.0 and run on 7.0. But the setup above is vanilla ESXi 6.5u3 ;)
Tested quickly on 6.7 and packer deployment works too!
Just follow https://nickcharlton.net/posts/using-packer-esxi-6.html
PORT STATE SERVICE
5900/tcp open vnc
Maybe it wont survive a reboot but 6.7 is an option as well. Only 7.0 has dropped vnc complete. I did not managed to find a workaround through custom vib or using the SDK. Feel free to add your additions https://github.com/clong/DetectionLab/issues/499
Hey @scaery - thanks for the write up and for the feedback! I'll definitely add some of the missing parts (e.g. sshpass, etc) and look into ways to standardize the network stuff. I think it probably makes sense to keep the network interfaces at 2 rather than 3 for simplicity, but the OS naming convention is where things get a little tricky. I'll look into this over the next few days and see what I can come up with.
@scaery can you expand upon why you needed to bump the max file limit?
@clong Yes, this was related playing with ansible forks setting https://github.com/ansible/ansible/issues/12259
Unexpected Exception: [Errno 24] Too many open files
In fact at least -f1 solved that issue while building on OSX, but playing around with like 100 forks just broke the ansible execution. On Mac the maxfilesize limit is by default rather low, so I increased the limit.
You maybe don't need this setting if you just use the -f1 switch I guess.
Keeping this as closed reference. All steps from above. Will try to dockerize it for myself ;)
sed -i -e "25,28d" ESXi/variables.tf
sed -i "s/eth1/eth0/g" ESXi/main.tf
sed -i "s/eth2/eth1/g" ESXi/main.tf
sed -i -e "90,94d;125,129d;160,164d" ESXi/main.tf
sed -i "s/eth2/eth1/g" ESXi/ansible/roles/logger/tasks/main.yml
sed -i "s/Ethernet2/Ethernet1/g" ESXi/ansible/roles/dc/tasks/main.yml
sed -i "s/Ethernet2/Ethernet1/g" ESXi/ansible/roles/wef/tasks/main.yml
sed -i "s/Ethernet2/Ethernet1/g" ESXi/ansible/roles/win10/tasks/main.yml
Just in case anyone needs a 2 NIC setup only without the extra NAT.
Here is my story about setting up Detection Lab up on ESXi 6.5. and my ramblings.
Building the Detection Lab on ESXi currently uses 3 network names. I did not used all 3 and removed the NAT network. Therefore I needed to change the IF naming conventions as well. Since I am working on VMware Workstation deployed ESXi, i just setup the additional "HostOnly Network" interface.
Changes to the code:
ESXi/main.tf (Line 52-56, 87-91, 122-126, 157-161)
ESXi/variables.tf (removed NAT)
ESXi/resources/01-netcfg.yaml (replaced eth2 with eth1)
For the inventory I had to lookup the IPs via
ipconfig
on the hosts manually :(ESXi/ansible/inventory.yml
Then I did the appropriate changes for the network interfaces on the Logger, DC, WEF and Win10:
ESXi/ansible/roles/logger/tasks/main.yml (Line 121)
ESXi/ansible/roles/dc/tasks/main.yml (Line 14)
ESXi/ansible/roles/wef/tasks/main.yml (Line 14)
ESXi/ansible/roles/win10/tasks/main.yml (Line 13)
But in my case the naming on the Windows boxes is not
Ethernet2
, it isEthernet1
for theHostOnly Network
. The internet accessibleVM Network
interface is namedEthernet0 2
.Maybe someone could enlight me to setup the network interface names in ESXi or terraform to rename them. Also, what is your setup so I can retry with the additional vm.nat interface? Then the
datastore1
anddatastore2
I had to replace manually in themain.tf
, because they are hardcoded and won't fit my storage on the ESXi ;( By default or if using ESXi on USB thedatastore1
nor 2 will exist, only if you setup ESXi having some additional space left.After these changes it all should go well. Currently only the Splunk Logger did not seem to get any events from the WEF ( even after fixing the network names and the boxes can reach each other on the 'HostOnly Network'. More digging time needed.
I was hit with unexpected bugs and various configuration advices that were missing from the documentation (e.g. sshpass needs to installed, ulimit needs to be increased, and extra option -f1 will help ansible to proceed, you should add
env no_proxy='*'
in front of ansible for deployment on OSX). Just weird stuff I had to fix. Maybe good if you can add these to the documentation.Could you please provide some more information on your ESXi network setup? Also I might think you have a mixed IP setup, very different the ones published in the repo. How can this be simplified or even automated?
TL;DR
Could you please provide a better documentation about setting this up with just 2 NICs or providing the right Networking Setup in your 3 NIC version setup? Still, I might think there is an issue with the interface naming.