Vagrant (VirtualBox) can’t connect to host-only network
If you’re unable to connect to your VM after upgrading VirtualBox, it’s most likely because of a documented, but well-hidden, change in networking in VirtualBox 6.1.28:
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
— https://www.virtualbox.org/manual/ch06.html#network_hostonly
It doesn’t help that VirtualBox will happily create a network interface with an IP outside of this range without raising as much as a warning — but it simply won’t work.
The solution #
The solution is to configure VirtualBox to allow other IP ranges. On your host machine create /etc/vbox/networks.conf
file with the subnet mask(s) that you’d like to allow. For example:
* 192.168.0.0/16
* 10.0.0.0/8
The above configuration will allow IPs in the ranges:
- 192.168.*
- 10.*