Why can’t I ping Google

dnsinternetippingroute

I can't ping google.com (unknown host). But I can ping IP addresses. I tried to ping the IP address of Google but it doesn't work.

  • resolv.conf

    nameserver 8.8.8.8 nameserver 209.139.209.33 
    
  • ifconfig -a

    eth0      Link encap:Ethernet  HWaddr 00:50:56:xx:xx:xx
              inet addr:10.2.0.63  Bcast:10.2.15.255  Mask:255.255.240.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:638762803 errors:0 dropped:0 overruns:0 frame:0
              TX packets:231307131 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:55502371533 (51.6 GiB)  TX bytes:23436883491 (21.8 GiB)
    
    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:56011078 errors:0 dropped:0 overruns:0 frame:0
              TX packets:56011078 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:4792283266 (4.4 GiB)  TX bytes:4792283266 (4.4 GiB)
    
  • route -n

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.2.0.0        0.0.0.0         255.255.240.0   U     0      0        0 eth0
    169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
    0.0.0.0         10.2.15.1       0.0.0.0         UG    0      0        0 eth0
    
  • ping -c 4 -n 8.8.8.8

    4 packets transmitted, 0 received, 100% packet loss, time 13000ms
    

Best Answer

If you can reach something by IP but not by name, then something's wrong with DNS lookup: your machine cannot find the IP address by name. Other than that, your networking and routing setup seems fine.

Things that could cause this:

  • DNS server down
  • Misconfigured of /etc/resolv.conf
  • Misconfigured of /etc/nsswitch.conf
  • ...

And probably others, but the first two are the most typical.

  • What's the nameserver in your network? Find out its name and IP address.
  • Can you ping it by IP address? If you cannot then it's down.
  • Is the nameserver correct in /etc/resolv.conf? If not then you need to add a line for it, for example: nameserver THE_IP
  • Is the nameserver dynamically set by DHCP in your network? If yes then you shouldn't mess with /etc/resolv.conf, it should be all automatic, and it looks like something's wrong at your provider's end.
Related Question