Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
    
share|improve this question
2  
You might look for /etc/resolv.conf in the manpages or the Internet search engines. –  galegosimpatico Jan 15 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 at 9:04
    
I can't ping 80.81.183.175 –  az93 Jan 15 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 at 9:55
1  
by the way resolv.conf should contain one entry per line –  SamK Jan 20 at 14:07

3 Answers 3

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

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

share|improve this answer
5  
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 at 9:21
    
It doesn't changes. I still can't ping. –  az93 Jan 15 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 at 10:02
    
After adding nameserver 8.8.8.8, I still can't ping google. –  az93 Jan 15 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 at 10:43

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.
share|improve this answer
    
The contents of resolv.conf nameserver 8.8.8.8 nameserver 209.139.209.33 –  az93 Jan 15 at 9:25
    
How do you know that 209.139.209.33 is correct for you? Can you ping it? –  janos Jan 15 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 at 9:46

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
share|improve this answer

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.