39

I got this error when I run vagrant up on my macOS:

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: 192.168.10.10 Ranges: 192.168.56.0/21

The same Vagrantfile works before, but not any more.

Any idea?

Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267

9 Answers9

110

I found the "issue" started to happen after VirtualBox 6.1.26.

The way to solve is creating a new file at /etc/vbox/networks.conf on your macOS with content

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

Make sure including the asterisks *. Then the issue should be gone.

Regarding the networks.conf content, it can be found at https://www.virtualbox.org/manual/ch06.html#network_hostonly

Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
9

By modifying the vagrantfile as below, it works for me.

cfg.vm.network "private_network", ip:"192.168.56.10"

I just changed the ip address from "192.168.1.10" to "192.168.56.10".

(Thanks to link in @Hongbo Miao's answers. (https://www.virtualbox.org/manual/ch06.html#network_hostonly))

최선웅
  • 191
  • 2
7

I had the same problem on MacOs with my Laravel Homestead and I solved doing:

sudo su -
mkdir /etc/vbox/
cd /etc/vbox/
echo '* 0.0.0.0/0 ::/0' > /etc/vbox/networks.conf
chmod 644 /etc/vbox/networks.conf
Davide Casiraghi
  • 15,591
  • 9
  • 34
  • 56
4

Changing a Vagrantfile directly is not recommended if you didn't create it. You can use this instead

vagrant config static_ip 192.168.56.2

The ip address can be any in the range 192.168.56.2 - 192.168.63.254. Make sure to run vagrant reload after making changes.

Mike Castillo
  • 41
  • 1
  • 1
  • yes, a /21 network can be calculated [here](https://www.calculator.net/ip-subnet-calculator.html?cclass=any&csubnet=21&cip=192.168.56.0&ctype=ipv4&printit=0&x=97&y=9) – rubo77 Apr 01 '22 at 22:46
3

Easy Solve

$ mkdir /etc/vbox/
$cd /etc/vbox/

vbox$ sudo vi networks.conf

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

These are some trouble shooting steps that i took for resolving the issue.

  1. In the System Preferences under Security & Privacy, enabling VirtualBox / Oracle.
  2. After the changes restart the VirtualBox

If these doesn't resolve the issue check the following in you Vagrant File.

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| os = "generic/ubuntu2004" net_ip = "192.168.50"

As you can see the ip range given is not what vagrant is looking for. Change the net_ip value to 192.168.56 .

This will resolve the issue.

DharmanBot
  • 1,066
  • 2
  • 6
  • 10
0

I had the same issue on macOS after a system upgrade. In the System Preferences under Security & Privacy, enabling VirtualBox / Oracle solved it.

trolologuy
  • 1,900
  • 4
  • 21
  • 32
  • I don't see "VirtualBox / Oracle" anywhere when I go to "Security & Privacy" and, of course, I am using VirtualBox as the provider. – nbro Apr 03 '22 at 16:52
0

Please check if your Virtualbox is updated! A reinstall solved this problem.

b00leant
  • 116
  • 1
  • 8
-1

Got the same issue solved by the following steps

sudo nano /etc/vbox/networks.conf

  • 10.0.0.0/8 192.168.0.0/16
  • 2001::/64
  • 0.0.0.0/0 ::/0

sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart