23

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
    
19
  • 2
    You might look for /etc/resolv.conf in the manpages or the Internet search engines.
    – 41754
    Jan 15, 2014 at 8:56
  • 1
    add the content of your resolve.conf file it's really hard to help you with so short info. having the result of ipconfig -a can also be nice
    – Kiwy
    Jan 15, 2014 at 9:04
  • I can't ping 80.81.183.175
    – az93
    Jan 15, 2014 at 9:25
  • 2
    Well you have no internet connectivity eitheir comming from your network settings you probably need a proxy as your currently in a company. @az93 a last test can be traceroute 8.8.8.8
    – Kiwy
    Jan 15, 2014 at 9:55
  • 1
    by the way resolv.conf should contain one entry per line
    – SamK
    Jan 20, 2014 at 14:07

6 Answers 6

5

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.
4
  • The contents of resolv.conf nameserver 8.8.8.8 nameserver 209.139.209.33
    – az93
    Jan 15, 2014 at 9:25
  • How do you know that 209.139.209.33 is correct for you? Can you ping it?
    – janos
    Jan 15, 2014 at 9:37
  • No I can't, but I asked in an other forum and they said to me to put these address
    – az93
    Jan 15, 2014 at 9:46
  • I manually set my address using the gui network manager tool. For whatever reason it wasn't updating my resolve.conf with my nameserver so I had to add it manually. FYI This is a basic home network so the nameserver was the same my gateway from ifconfig.
    – Jacksonkr
    Nov 7, 2016 at 15:16
3

This is a Google specific thing. I was just reading about this very issue in Google Groups. Apparently, when volumes of certain packet types are too high Google silently discards them. 8.8.8.8 is one of Google's public DNS servers and is well known for appearing to be down when it is in fact simply ignoring surplus (non-DNS) requests.

2
1

Looking at your IP configuration:

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)

Try changing the Bcast to 10.2.255.255 and Mask to 255.0.0.0

Open terminal and type the following command:

sudo vi /etc/network/interfaces

Find eth0 section and setup IP address as follows:

auto eth0
iface eth0 inet static
address 10.2.0.63
netmask 255.0.0.0
broadcast 10.2.255.255

Save and close the file. Once done, restart network:

$ sudo /etc/init.d/networking restart

Verify new IP address:

$ ifconfig eth0
$ ifconfig
0

The error you cannot ping www.google.com saying unknown host can be because the DNS resolution is not happening correctly. This may be because you have incorrectly configured DNS in your resolve.conf file. But as mentioned in the question if even the IP address of google cannot be ping then there may be an error of the configuration in the gateway in the /etc/network/interfaces file.

0

Since you have not shown your /etc/network/interfaces file this option is valid. Try changing from the static configuration to dhcp and run ping google.com. If it works then maybe another device has already the Ip you requested.

run nmap 10.2.0.* and check the available adresses.

I had the same issue and I couldn't figure out what the problem was. I checked the device connected to the router and found out that a maudit Android device had the ip I wrote in the interfaces file. I just changed it, and it worked.

-2

Execute this command to ping to google ( or any other site )

sudo echo "nameserver 8.8.8.8" >> /etc/resolv.conf

10
  • 8
    Don't do this without asking yourself if you want google to resolv every DNS request you make. You can ans should consider other free DNS like openDNS or maybe the DNS of your internet provider. Google 8.8.8.8 DNS is still a very good way to debug DNS issue.
    – Kiwy
    Jan 15, 2014 at 9:21
  • It doesn't changes. I still can't ping.
    – az93
    Jan 15, 2014 at 9:47
  • Why you are pinging to 8.8.8.8 ??? After adding nameserver 8.8.8.8, what is the output of ping google.com ?
    – SHW
    Jan 15, 2014 at 10:02
  • After adding nameserver 8.8.8.8, I still can't ping google.
    – az93
    Jan 15, 2014 at 10:08
  • 1
    OK, excuse me I don't speak english very well. It's written : ping: unknown host google.com. This is what you wanted ?
    – az93
    Jan 15, 2014 at 10:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .