Vagrant 2.2.18, OSX 11.6 cannot create private network

It looks like it might be an issue with Virtualbox itself. Attempting to create the NIC manually through Virtual Box’s host network manager results in the same error.

I am getting the same error on MacOS 11.6. VirtualBox version : 6.1.28 r147628 (Qt5.6.3)

I1021 13:15:23.604631   19891 main.go:130] libmachine: Found a new host-only adapter: "vboxnet5"
I1021 13:15:23.604650   19891 main.go:130] libmachine: COMMAND: /usr/local/bin/VBoxManage hostonlyif ipconfig vboxnet5 --ip 192.168.99.5 --netmask 255.255.255.0
I1021 13:15:23.691311   19891 main.go:130] libmachine: STDOUT:
{
}
I1021 13:15:23.691349   19891 main.go:130] libmachine: STDERR:
{
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp
}

192.168.56.4 worked for me, but did not get a message to reenter my password. I have other vagrant instances that worked before the upgrade that no longer work, they used 192.68.50.101

Why would changing the ip work?

I managed to get past the error by downgrading to VirtualBox 6.1.26.

1 Like

Thanks @scottblinch ! Downgrading to 6.1.26 resolved the issue for me as well.

1 Like

@scottblinch @imtiazc how did you go about downgrading the version?

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

2 Likes

I wrote out the steps I took in this thread: Vagran can not assign IP address to VirtualBox machine - #5 by scottblinch

(Copying from other thread for awareness)

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!

3 Likes

Thank you mikehenrty,
it’s work for me, i added /etc/vbox/networks.conf.

1 Like

Changing my guest ip: setting to 192.68.56.0 did not work for me. I’m using Mac OS X (Big Sur).

Changing my guest ip: setting to 192.68.56.0 did not work for me. I’m using Mac OS X (Big Sur).

Are you getting the same Code E_ACCESSDENIED error with that IP? Note, you might try rebooting your machine in case there are still some outdated virtual interfaces setup from previous attempts.

Also, did you create a /etc/vbox/networks.conf? If so, you should remove that file since it will invalidate 192.68.56.xx addresses (that was a problem I was running into before anyway).

I receive the same E_ACCESSDENIED error as before. Each subsequent run causes a new hostonlyif to get created, issuing the same error.

I did not create any /etc/vbox/networks.conf file, as our usage in CI will not allow that to be created on host systems that are creating the guest OS, and we’ve never had to create this file before. It all works normally when I switch back to 6.1.26 with with 192.68.56.0 or the default IP that Vagrant picks of 172.28.128.0.

I’ve removed all dhcpservers and all hostonlyifs using VBoxManage prior to any run to make sure it’s all cleared out, as I’ve has issues with this before, so I’m aware of it and clear them as needed.

Yes, I had to restart twice. Once to remove 6.1.26 and then a second time after installation of 6.1.28. Still have the same errors and issues as before. I then removed 6.1.28, restarted, installed 6.1.26, then restarted. And now it works normally again.

I also facing same issue in macOS Big Sur and using VirtualBox 6.1.28. Unable to find /etc/vbox/networks.conf file. Can somebody help me where can I get this file in macOS.

1 Like

same thing for me, i don’t find the folder /etc/vbox

downgrading to VirtualBox 6.1.26. solve the error

1 Like

@johnish This should be considered the solution, thanks! I chose 192.168.56.4

Do you by any chance know why this must be done?

had same issue with latest version of virtual box version 6.1.28, downgrade to version 6.1.26 using link above in comments worked.

Ok, this is strange. So I upgraded my Vagrant install to 2.2.19 that was just released 4 days ago. I then upgraded my VirtualBox from 6.1.26 (which I had downgraded to resolve this issue) to 6.1.28 again. I was going to try and test with this some more to see if I could get it to work with the recommended IP changes.

However, now, with those latest versions and no configuration changes on my part, it’s all working normally now and I can see DHCP servers and Host-Only IFs being created automatically with the new IP ranges that VirtualBox needed without me changing my Vagrantfile at all (e.g. output of VBoxManage list dhcpservers and VBoxManage list hostonlyifs).

For those having issues with this, try upgrading to Vagrant 2.2.19 and VirtualBox 6.1.28 and see if it works for you now. YMMV, because if you are specifically setting IPs in your Vagrantfile, you will probably need to change them to the valid ranges still. I was letting it use default IPs until this bug hit me and was unable to get it to work by setting them.

Warning: There is a bug in Vagrant 2.2.19 on MacOS that requires a manual file patch if you are using NFS, see: vagrant 2.2.19 nfs folders uninitialized constant error on Mac OS · Issue #12583 · hashicorp/vagrant · GitHub

Note: Another odd thing I noticed now that it’s working, the IPs it used by default are in the 192.168.56.0/21 range, not in 192.68.56.0/21 as noted by the VirtualBox documentation mentioned above, but it’s working. If I change my IP explicitly, Vagrant then issues a better error now:

The IP address configured for the host-only network is not within the
allowed ranges. Please update the address used to be within the allowed
ranges and run the command again.

  Address: 172.28.128.128
  Ranges: 192.168.56.0/21

Valid ranges can be modified in the /etc/vbox/networks.conf file. For
more information including valid format see:

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

Notice how it says 192.168.56.0/21 instead of 192.68.56.0/21 as noted in the VirtualBox documentation link referenced: 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.

Just edit or create the file /etc/vbox/networks.conf and change to:

* 0.0.0.0/0 ::/0

Do not forget the * at the beginning.

This will allow all addresses as host addresses like in old VirtualBox versions.

See: Chapter 6. Virtual Networking (6.7)