'The IP address configured for the host-only network is not within the allowed ranges

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?



Solution 1:[1]

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

Solution 2:[2]

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))

Solution 3:[3]

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.

Solution 4:[4]

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

Solution 5:[5]

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

Solution 6:[6]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 ???
Solution 3 Mike Castillo
Solution 4 trolologuy
Solution 5 shamim chowdhury
Solution 6 DharmanBot