Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

  1. Wireless Network Connection (my WWW connection)
  2. VirtualBox Host-Only Network (my VM)
  3. 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
share|improve this question
    
Can you visit your router page from the VM? –  Tom Wijsman Feb 27 '12 at 14:29
    
There's no GUI installed, however if do a wget on the URL then i get a 401 unauthorized (as expected). I can ping the router successfully. Where do you think the issue is? With my router? –  crmpicco Feb 27 '12 at 14:34
    
Not necessarily your router. Can you check whether the gateway is probably set on the VM guest, with ipconfig or ifconfig depending on operating system. Because I guess it can reach the first hop but doesn't know where to sent packets to that have to travel more than a single hop (that thus are not in the network segment). –  Tom Wijsman Feb 27 '12 at 14:36
    
I've just updated the main question with a dump from ifconfig on my VM. Does that look like it is configured correctly? How can I tell if the gateway is correctly configured? –  crmpicco Feb 27 '12 at 14:48
    
Oh right, that's different on Linux. You can see the routing information with route -n, this would also show the gateway if it's configured properly. –  Tom Wijsman Feb 27 '12 at 14:51

1 Answer 1

up vote 3 down vote accepted

Your routing table is incomplete.

Your computer only knows how to route to IPs that start with 192.168 and 169.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:

route add default gw 192.168.1.1

This would cause the table to look like this:

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
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

For more information on how this works, execute man route.

share|improve this answer
    
OK, I have added my router's IP address (192.168.0.1) to the routing table and I can ping Google on the 8.8.8.8 IP. However, for some reason, I still cannot wget or access any domain (which is a big issue)? Does this mean it is a DNS problem? –  crmpicco Feb 27 '12 at 15:11
    
Yes, it sound to me that you haven't followed any guide to set your internet up. Configure your DNS. –  Tom Wijsman Feb 27 '12 at 15:20
    
Thanks, DNS was infact the problem. I added 8.8.8.8 and 8.8.4.4 as primary and secondary DNS servers respectively using the "setup" command in CentOS. This adds the records to your /etc/resolv.conf file. Thanks for your help! –  crmpicco Feb 27 '12 at 16:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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