dhcp private_network failing on VirtualBox

ntwb edited this page Dec 31, 2014 · 3 revisions

There are a couple of errors you may encounter with dhcp failing in VirtualBox. The errors messages are usually something similar to the following:

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["dhcpserver", "add", "--ifname", "vboxnet0", "--ip", "172.28.128.2", "--netmask", "255.255.255.0", "--lowerip", "172.28.128.3", "--upperip", "172.28.128.254", "--enable"]

Stderr: VBoxManage: error: DHCP server already exists
A host only network interface you're attempting to configure via DHCP
already has a conflicting host only adapter with DHCP enabled. The
DHCP on this adapter is incompatible with the DHCP settings. Two
host only network interfaces are not allowed to overlap, and each
host only network interface can have only one DHCP server. Please
reconfigure your host only network or remove the virtual machine
using the other host only network.

These errors are often encountered after:

  • Fresh installs of both VirtualBox and Vagrant
  • Upgrading VirtualBox

On Mac this can be fixed by running the command: VBoxManage dhcpserver remove --netname HostInterfaceNetworking-vboxnet0

The best way to workaround this is by removing all off the VirtualBox DHCP Servers. To find out which servers are installed run the following command: VBoxManage list dhcpservers

You will see output similar to the following:

$ VBoxManage list dhcpservers
NetworkName:    HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2
IP:             0.0.0.0
NetworkMask:    0.0.0.0
lowerIPAddress: 0.0.0.0
upperIPAddress: 0.0.0.0
Enabled:        No

NetworkName:    HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
IP:             0.0.0.0
NetworkMask:    0.0.0.0
lowerIPAddress: 0.0.0.0
upperIPAddress: 0.0.0.0
Enabled:        No

NetworkName:    HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #3
IP:             172.28.128.2
NetworkMask:    255.255.255.0
lowerIPAddress: 172.28.128.3
upperIPAddress: 172.28.128.254
Enabled:        Yes

These adapters can be removed as follows: VBoxManage dhcpserver remove --netname "HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #3"

Upstream Vagrant issue #3083 and fixed in pull request #4882

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.