Start New Discussion Reply to this Discussion Can't ping localhost
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 127.0.0.1.
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.
Thanks,
Related Article: Can't ping MS
is a solved Networking discussion thread by Cross213 that has 1 reply and was last updated 9 months ago.
aryan200x
Newbie Poster
9 posts since Dec 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
cat /etc/hosts
You should see the lines similiar to:
127.0.0.1 localhost
127.0.0.1 servername.domain.local
Do you have this?
CimmerianX
Posting Pro
502 posts since Jul 2010
Reputation Points: 49
Solved Threads: 60
Skill Endorsements: 10
Thanks for help CimmerianX.
My /etc/hosts info is as below:
127.0.0.1 localhost.localdomain localhost
::1 localhost localhost6 localhost6.localdomain6
66.135.38.137 p2953393.pubip.serverbeach.com p2953393
and my /etc/resolv.conf info is as below:
domain pubip.serverbeach.com
options rotate
nameserver 216.187.125.131
nameserver 216.187.125.130
Please help me!
aryan200x
Newbie Poster
9 posts since Dec 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
Seems like your system is not checking the hosts file and thus can't resolve localhost to 127.0.0.1
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
CimmerianX
Posting Pro
502 posts since Jul 2010
Reputation Points: 49
Solved Threads: 60
Skill Endorsements: 10
© 2013 DaniWeb® LLC
Page rendered in 0.0728 seconds
using 2.66MB