Recently I decided to install virtualbox headless on my server to have something to play around with. Ok... cool...
The installation went fine, creation couple of VMs also.
Also I wanted to have my DHCP server, controlled by me. So far so good. I installed isc-dhcp-server on host, I configured it just fine... but at some point I realized that there is something wrong in the logs.
Jan 24 02:11:00 server dhcpd: DHCPDISCOVER from 08:00:27:3f:03:fe via vboxnet0
Jan 24 02:11:00 server dhcpd: DHCPOFFER on 192.168.56.253 to 08:00:27:3f:03:fe via vboxnet0
Jan 24 02:11:00 server dhcpd: DHCPREQUEST for 192.168.56.106 (192.168.56.100) from 08:00:27:3f:03:fe via vboxnet0: lease 192.168.56.106 unavailable.
Hmm! Houston we have a problem! After digging a little bit, I discovered that there is rogue DHCP server in my network... At least now I know what I am looking for.
I stopped my DHCP server, I disabled virtualbox DCHP server (from phpvirtualbox... I know, I was lazy) and my VM was still getting IP address... Something is fishy here. Ok, then maybe something is wrong with phpvirtualbox! I decided not to trust GUIs, so I started with to play around with cli commands:
vboxmanage list dhcpservers
Note: And this was the output after disabling the DHCP server from phpvirtualbox.
vboxmanage dhcpserver modify --netname HostInterfaceNetworking-vboxnet0 --disable vboxmanage list dhcpservers
Ok... I checked it one more time...
ifdown eth1 && ifup eth1
The VM received the same IP address! This is going to be though, I said to myself...
VBoxManage dhcpserver remove --netname HostInterfaceNetworking-vboxnet0
And now, when I listed the dhcpservers the above command returned nothing.
Perfect... I checked it again:
ifdown eth1 && ifup eth0
Still got the IP... Fuck!!!
Ok... This is my personal server, is not in production, I can afford to reboot it... (Please notice that I was lazy again... I could remove and add back the virtualbox kernel modules)
Guess what?! After rebooting my VM was able to get the right IP address from my DHCP server!
One thought on “virtualbox: Disable DHCP server for host-only network”