Vagrant 2.2.18, OSX 11.6 cannot create private network

I installed OSX updates and upgraded vagrant and virtualbox

Anytime I do a vagrant up I get

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

Command: [“hostonlyif”, “ipconfig”, “vboxnet3”, “–ip”, “192.168.50.1”, “–netmask”, “255.255.255.0”]

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

I have reinstalled viritualbox a couple of times, and allow the in the security settings, still not luck.

Public network does work.

I am trying a default Vagrantfile and have the same issue

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://vagrantcloud.com/search.
  config.vm.box = "ubuntu/xenial64"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # NOTE: This will enable public access to the opened port
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine and only allow access
  # via 127.0.0.1 to disable public access
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "192.168.33.10"

  #config.vm.network "private_network", type: "dhcp"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Enable provisioning with a shell script. Additional provisioners such as
  # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end
2 Likes

Edit VagrantFile and change the IP from 192.168.50.1 to something else, ex 192.168.56.4
Then run vagrant up again. You will most likely need to enter your password during this process.

Hey, I’m actually running into the same error. Changing to a different IP didn’t help in my case but will keep trying things and will let you know if we find something that helps.

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?