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

Discussions related to using VirtualBox on Linux hosts.

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

Postby rools » 8. Dec 2021, 17:42

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   Expand viewCollapse view
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.
rools
 
Posts: 3
Joined: 8. Dec 2021, 17:32

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

Postby mpack » 8. Dec 2021, 17:43

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.
mpack
Site Moderator
 
Posts: 35116
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

Postby scottgus1 » 8. Dec 2021, 17:48

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.
scottgus1
Site Moderator
 
Posts: 14294
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

Postby rools » 8. Dec 2021, 18:58

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.
rools
 
Posts: 3
Joined: 8. Dec 2021, 17:32

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

Postby scottgus1 » 8. Dec 2021, 19:02

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.
scottgus1
Site Moderator
 
Posts: 14294
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

Postby rools » 9. Dec 2021, 19:25

Oh thanks, that was that, the missing "* ", I missed that. Thank you.
rools
 
Posts: 3
Joined: 8. Dec 2021, 17:32

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

Postby scottgus1 » 9. Dec 2021, 19:27

Excellent, glad it was that simple!
scottgus1
Site Moderator
 
Posts: 14294
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 24 guests