Virtualbox NAT network not connecting to the Internet

Discussions related to using VirtualBox on Linux hosts.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Virtualbox NAT network not connecting to the Internet

Post by Perryg »

I don't do a lot with iptables myself but below is what mine reports.

Code: Select all

perry@perry-main ~ $ sudo iptables -L
[sudo] password for perry: 
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  
I really don't have an idea what could be the problem. As far as I know it should be working but you and I see it is not. Even if the previous version of VBox was not the upgrade should. One last thing you can try and it is just a hunch is to remove the adapter rule and reboot the guest.


delete /etc/udev/rules.d/70-persistent-net.rules and reboot
jrkul
Posts: 18
Joined: 23. Aug 2016, 16:44

Re: Virtualbox NAT network not connecting to the Internet

Post by jrkul »

I found no /etc/udev/rules.d/70-persistent-net.rules file on my guests:

Code: Select all

$ ls -l /etc/udev/rules.d
total 0
That file is on my host machine.

P.S.: I recreated the same environment on a second workstation and have the same issues.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Virtualbox NAT network not connecting to the Internet

Post by Perryg »

Well I'm all out of ideas since I can not replicate this, and don't see an error from your previous posts. Maybe someone else has seen this and has more information.
jrkul
Posts: 18
Joined: 23. Aug 2016, 16:44

Re: Virtualbox NAT network not connecting to the Internet

Post by jrkul »

I think there is something wrong with my natnetwork and my dhcpserver for the reasons I am going to explain.
I removed both virtual machines and reinstalled a new one selecting --before-- Ubuntu 16.04.3 installation:
Settings - Network - Adapter 1 - Attached to: NAT Network (name: testlab)

During OS installation I soon realized that there was no internet connection, because I was unable to set up my time zone, and therefore my keyboard layout, I could not retrieve any package (configuring apt was stuck) nor running "update-grub".

On the other hand, if I install Ubuntu choosing as network settings: Adapter 1 Attached to NAT, the installation proceeds without issues, the machine see the outside world and after installation I am able to ping 8.8.8.8 and install updates.
jrkul
Posts: 18
Joined: 23. Aug 2016, 16:44

Re: Virtualbox NAT network not connecting to the Internet

Post by jrkul »

I finally solved the issue and the new configuration works.
I deleted both natnetwork and dhcpserver and tried with a new IP address range:

Code: Select all

$ VBoxManage natnetwork add --netname 10.20.14-NAT --network "10.20.14.0/24" --enable
$ VBoxManage dhcpserver add --netname 10.20.14-NAT --ip 10.20.14.3 --netmask 255.255.255.0 --lowerip 10.20.14.200 --upperip 10.20.14.250 --enable
I found the above at the following link: https://jekewa.com/blogs/index.php/weBl ... 3-adds-nat
Now everything is fine: both virtual machines see the internet and can see each other.
I have no idea why the previous configuration did not work, but something has to do with the choice of the IP address range, which at the same time has nothing to do with my home computer network configuration, since the network 10.10.10.0/24 has no meaning for me. Perhaps has some meaning to Virtualbox? No idea.
Thanks @Perryg anyway for your support.
roemer2201
Posts: 28
Joined: 6. Feb 2008, 23:09
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: All

Re: Virtualbox NAT network not connecting to the Internet

Post by roemer2201 »

I just had the same issue, but wasn't even able to get it working after deleting and setting up a new NAT network with the command you provided. What finally helped was the following:

Code: Select all

VBoxManage natnetwork stop --netname 10.20.14-NAT
VBoxManage natnetwork start --netname 10.20.14-NAT
# no sudo required
Maybe someone will find this useful.

EDIT1: After launching another VM on the NAT network, this machine was not able to connect to the outside world. So I ran the start/stop commands again, after that it worked. Does one really have to start/stop the NAT network everytime a new machine joins it?
sessionzero
Posts: 4
Joined: 22. Jun 2018, 08:03

Re: Virtualbox NAT network not connecting to the Internet

Post by sessionzero »

I had the same issue on a fresh Ubuntu 18.04.1 host with VirtualBox sourced from the default repos (v5.2.10). Added in VirtualBox's repo, installed the current version (v5.2.18) and all works perfectly. Hope that helps someone else.

Wasn't able to get things going with any of the manual commands listed in this thread.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Virtualbox NAT network not connecting to the Internet

Post by socratis »

sessionzero wrote:with VirtualBox sourced from the default repos (v5.2.10)
That's actually the Ubuntu fork, not the official VirtualBox (which you got after adding the VirtualBox repo to your setup).
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply