I have a VirtualBox CentOS VM setup on my Windows 7 machine. I can ping my router, however I am unable to access the outside world.
In Windows I have three network connections setup:
- Wireless Network Connection (my WWW connection)
- VirtualBox Host-Only Network (my VM)
- Local Area Connection (unused)
I have my VM setup to use a bridged adapter to connect through the "Dell Wireless adapter".
Is there any reason why I should be unable to access the outside world from the VM?
I am trying to ping Google with:
ping 8.8.8.8
and getting connect: network is unreachable
This is a dump from ifconfig:
eth0 Link encap:Ethernet HWaddr 08:00:27:F2:EF:F7
inet addr:192.168.0.25 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3310 errors:0 dropped:0 overruns:0 frame:0
TX packets:337 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:292875 (286.0 KiB) TX bytes:40593 (39.6 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:249 errors:0 dropped:0 overruns:0 frame:0
TX packets:249 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:20076 (19.6 KiB) TX bytes:20076 (19.6 KiB)
Here is a dump from route -n:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
Best Answer
Your routing table is incomplete.
Your computer only knows how to route to IPs that start with
192.168
and169.254
but does not know how to route to any other IPs, we'll want any other IPs to be routed through your router.If your router would be
192.168.1.1
, you can for example execute:This would cause the table to look like this:
For more information on how this works, execute
man route
.