The IP address configured for the host-only network is not within the allowed ranges
Asked Answered
M

9

43

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?

Mamelon answered 13/1, 2022 at 22:54 Comment(1)
Was this issue with Laravel homestead?Pipette
M
119

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

Mamelon answered 13/1, 2022 at 22:54 Comment(6)
Vagrant was still throwing issues for me when adding this, a quick restart sorted that.Hypnotism
Thanks!. Have to mention that the character * is a must, firstly I though it was for enumerating a list of values. Full doc: virtualbox.org/manual/ch06.html#network_hostonlyConveyancer
Confirming this fix for Ubuntu 20.04LTSStudious
I don't have the permissions to create the directory /etc/vbox/, which I don't have. Of course, I could use sudo to create this directory, but are you sure this is the right solution? Why can't you just configure the IP address in the Vagrantfile, as explained in the other answer?Bombard
This works for me with ubuntu 22.04. KudosPastiche
works for Linux Mint!Kingdon
C
11

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

Cori answered 25/2, 2022 at 7:52 Comment(0)
P
10

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
Pipette answered 7/10, 2022 at 8:15 Comment(0)
C
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.

Coastwise answered 5/3, 2022 at 6:2 Comment(1)
yes, a /21 network can be calculated hereRouth
M
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
Medlin answered 22/4, 2022 at 5:27 Comment(0)
N
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.

Novation answered 10/5, 2022 at 11:23 Comment(0)
W
0

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

Williamson answered 14/2, 2022 at 10:39 Comment(1)
I don't see "VirtualBox / Oracle" anywhere when I go to "Security & Privacy" and, of course, I am using VirtualBox as the provider.Bombard
B
0

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

Botswana answered 25/7, 2022 at 16:49 Comment(1)
I was using addresses like 172.16.3.X and because of the * 0.0.0.0/0 in this answer, it basically fixed it so all my old VM IP addresses worked again! Looks like the formatting didn't preserve the * symbols correctly thoughMackey
K
0

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

Keratosis answered 15/2, 2023 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.