4

I have VirtualBox installed on a Windows 8 host. I was using the VirtualBox DHCP server for a while, but now I'm trying to switch over to a DHCP server installed on one of the guests. The VirtualBox DHCP still seems to be supplying addresses.

I will use two specific guests and their status as an example here, one of them CentOS the other Ubuntu, so I'll just call them that here.

Initial environment before the change:

The VirtualBox DHCP was one I added (VBoxManage dhcpserver add with server IP 10.10.10.1). CentOS was getting 10.10.10.2 from it and Ubuntu was getting 10.10.10.3 from it.

Recent Changes:

  1. Installed DHCP server on CentOS with range 192.168.0.10 - 192.168.0.99, and a fixed entry for Ubuntu of 192.168.0.102.
  2. Set static IP 192.168.0.7 on CentOS.
  3. Removed the VBox DHCP server I had added earlier by doing a VBoxManage dhcpserver remove. VBoxManage list dhcpservers does verify that the 10.10.10.1 DHCP server is gone.
  4. Completely restarted CentOS and then Ubuntu.

Behavior:

On CentOS, DHCP service is running. It gets its statically assigned IP address correctly. When I start up Ubuntu, it still gets 10.10.10.3. If I do ifdown eth0, it get output DHCPRELEASE on eth0 to 10.10.10.1. If I then do ifup eth0 it outputs that it is sending a DHCP discover, then DHCPREQUEST of 10.10.10.3 on eth0 to 255.255.255.255, and that it gets a DHCPOFFER of 10.10.10.3 from 10.10.10.1, then DHCPACK of 10.10.10.3 from 10.10.10.1, after which I obviously have the 10.10.10.3 address.

Question Reiterated

Why is Ubuntu still getting that address, and from 10.10.10.1? Better yet, HOW is it getting it? Is the VBox DHCP server still running even though I did a dhcpserver remove and it's not in the list anymore? If it is still running somewhere, how do I get rid of it?

Some other tests I did

As an extra test, I did a VBoxManage dhcpserver add again to add a DHCP server with the same information as the one I had before. I created it without enabling it, verified it was in disabled state, restarted Ubuntu, got 10.10.10.3, enabled the VBox DHCP server, restarted Ubuntu, and I got 10.10.10.2 this time. I disabled/enabled VBox DHCP a few times and, each time it was disabled or enabled, I did ifdown/ifup, and this was what happened then: sometimes it would get 10.10.10.2 for each step (request/offer/ack/bound), and sometimes 10.10.10.3 for each one, but sometimes it would request 10.10.10.2, get offered 10.10.10.2, but then get an ack of 10.10.10.3 and then bind to 10.10.10.3, and sometimes the opposite of request 10.10.10.2, offer 10.10.10.2, ack 10.10.10.3, bind 10.10.10.3. Then I removed the VBox DHCP server again, verified it's gone again, and I keep doing ifdown/ifup on Ubuntu and getting the same results as above: all 3's, all 2's, or 2/2/3/3, or 3/3/2/2 to the request/offer/ack/bind. Now maybe I have two VBox DHCP servers running invisibly somewhere... :(

As another test, I set the IP statically on Ubuntu, did ifdown/ifup, and it got the IP I set. I could even communicate with CentOS correctly since I set it to be in the same subnet. Switched it back to get IP from DHCP again, restarted the interface again, and it went back to the 10.10.10 stuff.

The contents of /etc/dhcp/dhcpd.conf on CentOS:

subnet 192.168.0.0 netmask 255.255.255.0 {
    range 192.168.0.10 192.168.0.99;
        option subnet-mask 255.255.255.0;
    host ubuntuserver {
        hardware ethernet 08:00:27:10:F0:B9;
        fixed-address 192.168.0.102;
    }
}

Just in case anyone is wondering, yes I did boot up more guests as well, and yes the ones set to get from DHCP were getting from 10.10.10.1 and getting an address in that range as well.

I cannot properly do my full test environment, which is supposed to be able to mimic a production environment, while the virtual network is in this state. If you can help me to kill the 10.10.10.1 server, I would be very grateful.

3

Based upon the last line in http://zaidmunir.blogspot.in/2010/07/how-to-enabledisable-virtualboxs-dhcp.html

due to a bug in VBox the DHCP is not truly disabled till the time you restart the host machine (The machine on which VBox is running).

Have you tried this?

  • 1
    No need to restart the whole host, it suffices to reload the drivers. sudo vboxreload does the trick for me (using VirtualBox 5.1.26 on Linux). – Rob W Aug 27 '17 at 15:51
  • I don't recall, and I'm far removed from that project now so I cannot test any longer. Thanks though. I'll mark your answer as accepted since it is documented. – Loduwijk Jun 14 '19 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.