Sunday, April 17, 2011

VirtualBox Linux Guest Host-Only Interface DHCP Problem Fix

I have a Ubuntu 9.10 Server Guest VM running on Windows XP SP3 Host. I wanted to change the range of the Host-Only Interface IP to the 10.10.10.x from 192.168.56.x which is default VirtualBox Host-Only Range.
Changing this using the GUI caused some weird errors resulting in No DHCP offers inside VM's. I tried adding new Host-Only interface but that also gave error. I was not able to delete the old one causing 2 overlapping Host-only interfaces which can only be seen through the command line VBoxManage.exe , Not in the Preferences Tabs of VirtualBox GUI.
So here is how to do it.

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe list dhcpservers
NetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2
IP: 10.1.1.2
NetworkMask: 255.255.255.0
lowerIPAddress: 10.1.1.101
upperIPAddress: 10.1.1.254
Enabled: Yes

NetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
IP: 10.10.10.1
NetworkMask: 255.255.0.0
lowerIPAddress: 10.10.10.2
upperIPAddress: 10.10.10.100
Enabled: Yes

Now there are 2 Host Interfaces with overlapping IP ranges causing conflicts. Now we will delete this using the VBoxManage.exe

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe dhcpserver remove --netname "HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2"

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe list dhcpservers
NetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
IP: 10.10.10.1
NetworkMask: 255.255.0.0
lowerIPAddress: 10.10.10.2
upperIPAddress: 10.10.10.100
Enabled: Yes

Then start the VirtualBox DHCP server

C:\Program Files\Oracle\VirtualBox>VBoxNetDHCP.exe


C:\Program Files\Oracle\VirtualBox>tasklist
[snipped]
wordpad.exe 5060 Console 0 1,828 K
VirtualBox.exe 5480 Console 0 9,040 K
VBoxNetDHCP.exe 4692 Console 0 4,672 K
[snipped]

Now the VM will get DHCP offers from the Host Only interface.

No comments:

Post a Comment