“connect: Network is unreachable” in VirtualBox VM

networking, virtual-machine

Solution

The output of `ifconfig` indicates that there is no IP set on the eth2 interface. First you need to assign IP on eth2 as

sudo ifconfig eth2 192.168.1.100

if you want to assign 192.168.1.100 as static IP on the interface. Else use

sudo dhclient eth2

to obtain IP from DHCP server

Problem

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?)

Original source