Start New Discussion within our Networking Community

I have a Linux(Centos 6.3) dedicated server. When i log into it through SSH(PuTTy) and issue the command 'root@p2953333#ping localhost' it gives the error 'ping: unknown host localhost' as i can ping any other ips including
i have googled alot and find some solutions like checking settings in /etc/hosts and /etc/nsswitch.conf which are correct in my server.
Any help appreciated.


cat /etc/hosts

You should see the lines similiar to:      localhost      servername.domain.local

Do you have this?

Thanks for help CimmerianX.

My /etc/hosts info is as below: localhost.localdomain localhost
::1 localhost localhost6 localhost6.localdomain6 p2953393

and my /etc/resolv.conf info is as below:

options rotate

Please help me!

Seems like your system is not checking the hosts file and thus can't resolve localhost to

Look at /etc/nsswitch.conf. This file should have certain permissions 644. If not, then use:

chmod 644 /etc/nsswitch.conf

Cat nsswitch.conf and make sure have the following:

hosts: files dns
This article has been dead for over six months. Start a new discussion instead.