Ubuntu – VirtualBox with Ubuntu Server guest can’t ping outside

nat;networkingubuntu 12.04virtual machinevirtualbox

Here's my situation:

  • an Ubuntu 12.04 Host running VirtualBox;
  • two guest VMs running Ubuntu Server 12.04
  • home network, so my Host pc has a wireless connection to the router of my ISP.

My problem is in one of the virtual machines: it has 3 NICs, one in NAT mode and the others in Host Only mode. My purpose is to use eth0 (NAT) for Internet access and eth1, eth2 (Host Only) for management of internal virtual network (eth1 uses a VBoxNet with this IP 192.168.69.254).

Whenever I try to $ping 8.8.8.8 I get Destination Host Unreachable.

While if I $ping 192.168.69.10, that is the IP of the other VM, it works.

I can't also ping my Host nor my router

My /etc/network/interfaces file is:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.69.1
netmask 255.255.255.0

auto eth2
iface ifconfig $IFACE 0.0.0.0 up
up ip link set $IFACE promisc on
down ip link set $IFASE promisc off
down ifconfig $IFACE down

$route -n returns:

Destination   Gateway     Genmask        Flags Metric Ref Use Iface
0.0.0.0       10.0.2.2    0.0.0.0        UG    100    0   0   eth0
10.0.2.0       0.0.0.0    255.255.255.0  U       0    0   0   eth0 
192.168.69.0   0.0.0.0    255.255.255.0  U       0    0   0   eth1
192.168.100.0  0.0.0.0    255.255.255.0  U       0    0   0   virbr0

Forgetting for now what eth2 needs to do and its setup, why I can't go outside the Host box?

What can I do to help you helping me? 🙂


-Edit-

On my Host:
$ ifconfig -a

eth0  Link encap:Ethernet  IndirizzoHW 00:26:9e:d5:1a:bb  
      UP 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
      collisioni:0 txqueuelen:1000 
      Byte RX:0 (0.0 B)  Byte TX:0 (0.0 B)

eth1  Link encap:Ethernet  IndirizzoHW c4:17:fe:17:31:b3  
      indirizzo inet:192.168.1.186  Bcast:192.168.1.255  Maschera:255.255.255.0
      indirizzo inet6: fe80::c617:feff:fe17:31b3/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:1774067 errors:3 dropped:0 overruns:0 frame:3371346
      TX packets:1486276 errors:266 dropped:0 overruns:0 carrier:0
      collisioni:0 txqueuelen:1000 
      Byte RX:1642836807 (1.6 GB)  Byte TX:170395284 (170.3 MB)
      Interrupt:16 

lo    Link encap:Loopback locale  
      indirizzo inet:127.0.0.1  Maschera:255.0.0.0
      indirizzo inet6: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:9119 errors:0 dropped:0 overruns:0 frame:0
      TX packets:9119 errors:0 dropped:0 overruns:0 carrier:0
      collisioni:0 txqueuelen:0 
      Byte RX:1089979 (1.0 MB)  Byte TX:1089979 (1.0 MB)

vboxnet0  Link encap:Ethernet  IndirizzoHW 0a:00:27:00:00:00  
      indirizzo inet:192.168.69.254  Bcast:192.168.69.255  Maschera:255.255.255.0
      indirizzo inet6: fe80::800:27ff:fe00:0/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2314 errors:0 dropped:0 overruns:0 carrier:0
      collisioni:0 txqueuelen:1000 
      Byte RX:0 (0.0 B)  Byte TX:345450 (345.4 KB)

vboxnet1  Link encap:Ethernet  IndirizzoHW 0a:00:27:00:00:01  
      indirizzo inet:192.168.57.1  Bcast:192.168.57.255  Maschera:255.255.255.0
      indirizzo inet6: fe80::800:27ff:fe00:1/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2082 errors:0 dropped:0 overruns:0 carrier:0
      collisioni:0 txqueuelen:1000 
      Byte RX:0 (0.0 B)  Byte TX:331256 (331.2 KB)

Best Answer

I had the same problem. I solved it by changing my virtualbox network adapter from "NAT" to "bridge adapter".

You can use NAT for port forwardind. So you can, for example, configure your forwarding table to forward request from port 8080 to your virtual server.

Related Question