I have been using Virtualbox to run mininet simulations. I have two adapters, eth0 uses NAT and has the IP address and eth1 is a host only adapter. I can SSH into the VM using, however when I try to reach anything external to the network from the VM (for example cloning a git repository), I get the message network unreachable. I have tried pinging IP addresses directly to check that it is not a DNS issue. Why can I not reach the internet? I understand that a common issue is that an IP address has not been assigned to one of the adapters, but here eth0 quite clearly has an IP address.

ifconfig -a:

eth0      Link encap:Ethernet  HWaddr 08:00:27:ef:9b:c8  
          inet addr:  Bcast:  Mask:
          RX packets:235 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:25042 (25.0 KB)  TX bytes:23566 (23.5 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:76:c7:9a  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:432 errors:0 dropped:0 overruns:0 frame:0
          TX packets:432 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:34376 (34.3 KB)  TX bytes:34376 (34.3 KB)

Virtualbox's "Host-only" adaptors specifically don't allow internet access: https://www.virtualbox.org/manual/ch06.html#networkingmodes

Host-only networking

This can be used to create a network containing the host and a set of virtual machines, without the need for the host's physical network interface. Instead, a virtual network interface (similar to a loopback interface) is created on the host, providing connectivity among virtual machines and the host.

Check the table at the end of the 6.2 section to see which types of adaptors do what you actually want them to do (hint: probably one of Bridged, NAT or NAT-Network).

I'd try disabling your host-only adaptor and see if that's the cause of the problem.

  • When I disable the host-only adapter it does work. Any idea how to allow internet access whilst also having a host-only adapter enabled? And just to be clear - I had both a NAT adapter and a host-only adapter enabled originally. I would like the host-only adapter for the mininet simulation and the NAT adapter for internet access to Github etc. – JC2188 Apr 26 '18 at 19:32
  • I think you're missing something here - as in you are trying to do something host-only specifically WILL NOT DO. Host-only gives you communication between VM's and host, that's it. You want the other options on that page, so you need to go look at that chart I mentioned and figure out what adaptor you really wanted. – s1ns3nt Apr 27 '18 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.