“connect: Network is unreachable” in VirtualBox VM

internet connectionvirtualbox

Host: WinXP, guest: Ubuntu 12.10, connection type: only NAT.
Kernel IP routing table (route -n) contains only header

ifconfig:

eth2      Link encap:Ethernet  HWaddr 08:00:27:c6:86:82  
          inet6 addr: fe80::a00:27ff:fec6:8682/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:4391 (4.3 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1184 (1.1 KB)  TX bytes:1184 (1.1 KB)

ping of any internet address gives error:
connect: Network is unreachable

How to connect to the internet from VM? What settings should be in the Network Connections -> DSL (or Wired?)

Best Answer

I notice your Ethernet interface is identified as eth2. This can happen if you changed the ethernet interface MAC address, maybe because you cloned from another VM.

Can you connect to the host machine, but not the internet? If so, try the solution from this VirtualBox forum thread.

To sum it up, you want to delete /etc/udev/rules.d/70-persistent-net.rules and reboot. The ethernet interface will identify as eth0 now and everything should work.

Related Question