Centos – I can ping IPs, but can’t ping any domain

centosdomain-name-systemping

I have a CentOS 6 x86 server. If I ping 8.8.8.8 and my server gateway, there's no problem. If I ping google.com, yahoo.com, etc, it returns "ping: unknown host google.com".

When I saw this problem, first thing I go to check is the /etc/resolv.conf file, but this file seems no problem. Where else should I check?

nameserver 8.8.8.8
nameserver 8.8.4.4

Best Answer

Few things you can try

Look at

/etc/nsswitch.conf 

Look for hosts: and see if it has dns listed

Then try to query google.com from their nameservers.. maybe output dns requests are failing

nslookup google.com 8.8.8.8

If that fails.. then

telnet 8.8.8.8 53

If you get a connection refused.. your ISP might be blocking your dns requests and you have to use their resolvers.