Vagran can not assign IP address to VirtualBox machine

OS: Centos7
VirtualBox: 6.1.28r147628

I’m trying to start SaltStack tutorial Demo Environment, but when I start vagrant with vagrant up command there is the following error:

I have the same issue on OSX

We had a similar error in this thread: Vagrant 2.2.18, OSX 11.6 cannot create private network - #4 by scottblinch

I and another user were able to resolve it by downgrading Virtualbox to 6.1.26.

1 Like

How did you downgrade? Did you uninstall?

https://www.virtualbox.org/wiki/Download_Old_Builds_6_1

Here are the steps I took when downgrading. Note that I am not very well-versed in virtual machines and have no idea whether all of these steps are actually necessary, but are just what I did while trying to be very careful of not leaving any messes on my machine.

  1. Destroyed my virtual machine
  2. Deleted all the NICs that were created by VirtualBox while trying to bring the machine up
  3. Uninstalled VirtualBox through the uninstall tool provided in the installer archive
  4. Restarted my host machine
  5. Installed 6.1.26 from here: Download_Old_Builds_6_1 – Oracle VM VirtualBox
  6. Granted the security permission
  7. Restarted my host machine
  8. Successfully ran vagrant up
1 Like

@scottblinch thank you very much! It was very helpful :nerd_face:

I encountered the same error on Arch Linux. It seems like Vagrant (or VirtualBox) cannot create a host network when the IP address doesn’t match some requirements which is unknown.

Temporary solution for my case:

  1. add a new host network via the Host Network Manager (“File > Host Network Manager”)
    • leave the IP address as is created automatically. it complains if you try to change it to something else.
  2. assign the created IP address to the guest machine

VirutalBox: 6.1.28 r147628
OS: 5.14.14-arch1-1

This issue comes from a new IP restriction for Host-Only networks in VirtualBox 6.1.28. See docs here:

https://www.virtualbox.org/manual/ch06.html#network_hostonly

On Linux, Mac OS X and Solaris Oracle VM VirtualBox will only allow IP addresses in 192.68.56.0/21 range to be assigned to host-only adapters. For IPv6 only link-local addresses are allowed. If other ranges are desired, they can be enabled by creating /etc/vbox/networks.conf and specifying allowed ranges there. For example, to allow 10.0.0.0/8 and 192.168.0.0/16 IPv4 ranges as well as 2001::/64 range put the following lines into /etc/vbox/networks.conf:

      * 10.0.0.0/8 192.168.0.0/16
      * 2001::/64

For me I solved it by changing my guest IP to 192.68.56.0. I was also able to find some success by adding my original IP to the /etc/vbox/networks.conf file. But while the error went away with that setup (and I could ping the box), for some reason I couldn’t access the apache webserver (port 80 or 443) from my host after running my vagrant box. This part might be a bug in Vagrant (for instance, maybe it needs to configure /etc/network/interfaces inside the guest here?

In any case, I hope this helps!

Installing latest Vagrant 2.2.19 and VirtualBox 6.1.28 seems to have resolved this issue (at least for me). See Vagrant 2.2.18, OSX 11.6 cannot create private network - #22 by robert914

Which OS version are you on? We are currently having a similar issue but it’s because we upgraded to macOS Monterey. Can someone give me an example of what the /etc/vbox/networks.conf should look like and also can you verify the location of that file. Thanks in advanced! Please help :slight_smile: