Cannot create a private networck from Vagrant in VirtualBox after updating it

Discussions related to using VirtualBox on Linux hosts.
Post Reply
rools
Posts: 3
Joined: 8. Dec 2021, 17:32

Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by rools »

Hello,

I have upgraded VirtualBox from 6.1.26-2 to 6.1.28-3 (in Manjaro) and then I was not able to set up a private network with Vagrant.
Here is my Vagrantfile:

Code: Select all

Vagrant.configure("2") do |config|
      config.vm.box = "centos/7"
      config.vm.hostname = "Name"
      config.vm.network :forwarded_port, guest: 22, host: 2336, id: 'ssh'
      config.vm.network :private_network, ip: "10.1.45.3", netmask: "255.255.0.0"
end
When I did a `vagrant up`, I got:
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: 10.1.45.3
Ranges: 192.168.56.0/21

Valid ranges can be modified in the /etc/vbox/networks.conf file. For
more information including valid format see:

www . virtualbox . org/manual/ch06.html#network_hostonly
I followed the guide from the error message (cannot post it, rejected) and created the file /etc/vbox/networks.conf with:
0.0.0.0/0 ::/0
And, when I run `vagrant up` again, I got:
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: 10.1.45.3
Ranges:

Valid ranges can be modified in the /etc/vbox/networks.conf file. For more information including valid format see:

www . virtualbox . org/manual/ch06.html#network_hostonly
Why does "Ranges" is empty? I tried with other values for ranges but it did not change anything.

I checked the IP for the NAT interface and there was no conflict (10.0.2.15/24).

Thank you for your help.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by mpack »

Vagrant is supported on the Vagrant forums.

10.x is typically a NAT IP address, not a host-only address. Recent versions of VirtualBox insist that you use (from memory) 192.168.56.x for host-only addressing.

As explained in the user manual, section 6.7:
On Linux, Mac OS X and Solaris Oracle VM, VirtualBox will only allow IP addresses in 192.168.56.0/21 range to be assigned to host-only adapters. For IPv6 only link-local addresses are allowed. If other ranges are desired, they can be enabled by creating /etc/vbox/networks.conf and specifying allowed ranges there.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by scottgus1 »

There is a new requirement for Host-Only networks since 6.1.28 that plugs a security hole. See https://www.virtualbox.org/manual/ch06. ... k_hostonly, at the end of the section, starting at "On Linux, Mac OS X and Solaris Oracle VM VirtualBox...".

Once you have the new setup in place you should be able to use your desired IP address range, at least in a Virtualbox-only non-Vagrant-influenced setting. It may even work under Vagrant, too.
rools
Posts: 3
Joined: 8. Dec 2021, 17:32

Re: Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by rools »

Hello, thank you for your quick replies.
I know Vagrant is not supported, but I do not know how to reproduce without Vagrant.

And I followed what said in the documentation but got an empty "Ranges".

@mpack: I did try other IP addresses, with same result.
For instance, if I use 192.168.56.12, I get
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.56.12
Ranges:

Valid ranges can be modified in the /etc/vbox/networks.conf file. For
more information including valid format see:

www . virtualbox . org/manual/ch06.html#network_hostonly
@scottgus1: Yes, I followed this guide. This is after that I get the empty "Ranges" (see my first post). With this "new setup in place", it changed nothing. That is why I posted here.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by scottgus1 »

Ah, yes, sorry, I missed that!

Curious, though, this might be a syntax error:
The manual wrote: * 0.0.0.0/0 ::/0
rools wrote:created the file /etc/vbox/networks.conf with:
0.0.0.0/0 ::/0
It looks like you don't have the asterisk and space the manual calls for.
rools
Posts: 3
Joined: 8. Dec 2021, 17:32

Re: Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by rools »

Oh thanks, that was that, the missing "* ", I missed that. Thank you.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by scottgus1 »

Excellent, glad it was that simple!
SylvPichot
Posts: 1
Joined: 28. Jan 2022, 20:35

Re: Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by SylvPichot »

Hi !

On MacOS Monterey M1, I have the same issue, but I can't fix it..

in hosts file, I put

Code: Select all

192.168.56.12 myurl.local
in /vbox/networks.conf file, I put

Code: Select all

* 0.0.0.0/0 ::/0
Like said in virtualbox guide, I tried also

Code: Select all

* 10.0.0.0/8 192.168.0.0/16
* 2001::/64
I have a new error :
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 95 of file VBoxManageHostonly.cpp
Any Idea ?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Cannot create a private networck from Vagrant in VirtualBox after updating it

Post by mpack »

SylvPichot wrote: On MacOS Monterey M1, I have the same issue, but I can't fix it..
No, that would be a totally different problem, i.e. that VirtualBox VMs can't run on an M1 CPU. VirtualBox is not a CPU emulator.
Post Reply