After VirtualBox update vagrant up
failing with the following error on Ubuntu:
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", "vboxnet2", "--ip", "10.160.0.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
Used versions:
As of VirtualBox 6.1.28, host-only network adapters are restricted to IPs in the range 192.168.56.0/21 by default (192.168.56.1 -> 192.168.63.254).
You can tell VirtualBox to allow additional IP ranges by configuring /etc/vbox/networks.conf
. For example, to allow anything in the 10.x.x.x range you could use:
* 10.0.0.0/8
For more info, see the docs at https://www.virtualbox.org/manual/ch06.html#network_hostonly
After scanning through the VirtualBox documentation on host-only networks, you will see that for Solaris, Linux and MacOS the allowed ip range for host-only networks has changed. VirtualBox will now only accept IP addresses to be assigned in the 192.168.56.0/21 range. The errors above show that Docker is trying to create and assign a 192.168.99.1/24 address and mask.
There are now 2 obvious solutions, one would be changing the way how docker creates your machine so it fits in the “new” address space that VirtualBox now uses:
docker-machine create --driver virtualbox --virtualbox-memory "2048" --virtualbox-hostonly-cidr 192.168.56.1/21 default
We can also solve this at the other side of the problem, that is changing the behaviour of VirtualBox. In order to do this we need to create the file networks.conf in /etc/vbox:
sudo mkdir /etc/vbox
sudo nano /etc/vbox/networks.conf
In the networks.conf we can tell VirtualBox what networks we are allowing:
* 10.0.0.0/8 192.168.0.0/16
* 2001::/64
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With