Operating System - HP-UX
1819801 Members
3037 Online
109607 Solutions
New Discussion юеВ

Cannot ping localhost (127.0.0.1)

 
Gan Hong Chong
New Member

Cannot ping localhost (127.0.0.1)

I encounter this thing in a few of my servers.
Once a week or once a month, when I login to the server, I cannot ping localhost. At first I thought it is IP resolution issue. But when I ping 127.0.0.1, it is not pingable.
To make it pingable, I have to do ifconfig lo0 down and up.
The localhost and loopback and its IP is setup in /etc/hosts. My routing table is ok.

What can cause this thing to happen?
Anything that I can check?

Thanks.
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: Cannot ping localhost (127.0.0.1)

Very common cause:

/etc/hosts has been changed.

The loopback line needs to never be changed.

Also look for conflicts with /etc/rc.config.d/netconf

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jeff Schussele
Honored Contributor

Re: Cannot ping localhost (127.0.0.1)

Hi,

Also make sure that localhost is not being populated in DNS.
I've seen that happen a few times.
It should never be in there.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Andy Torres
Trusted Contributor

Re: Cannot ping localhost (127.0.0.1)

Depending on your OS, patch level, and hardware, you may see some error stats on your NIC hardware using the lanadmin or netstat commands. See man pages for more.
Gan Hong Chong
New Member

Re: Cannot ping localhost (127.0.0.1)

Hi all,

Thanks for the reply.

1) /etc/hosts' loopback line is ok and look like this:
127.0.0.1 localhost loopback

Also, the /etc/rc.config.d/netconf do have have conflict with the localhost and is look like
this:
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1
INTERFACE_NAME[0]="lan10"
IP_ADDRESS[0]="155.125.30.92"
SUBNET_MASK[0]="0xffffff00"
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0
ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="155.125.30.1"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""
INTERFACE_NAME[1]="lan6"
IP_ADDRESS[1]="155.125.119.5"
SUBNET_MASK[1]="255.255.255.0"
ROUTE_GATEWAY[1]=""
ROUTE_DESTINATION[1]=""
ROUTE_COUNT[1]="1"

2) localhost is not defined in my DNS environment.
Actually, this issue only happen to a few servers.
My all other servers are ok


3) What do you mean by using lanadmin/netstat to check for errors?
Which option you are talking about, -s, -M?
Can you give some example?
Joseph Loo
Honored Contributor

Re: Cannot ping localhost (127.0.0.1)

hi,

what does /etc/nsswitch.conf contain?

also, reply on:

# nslookup localhost

regards.
what you do not see does not mean you should not believe
Andy Torres
Trusted Contributor

Re: Cannot ping localhost (127.0.0.1)

Sorry, I should have read more closely. I suggested lanadmin & netstat for error checking, but since this is a problem with loopback there's no actual hardware to check.

The only way I can think of causing this type of loopback interruption is if something suddenly tried to bind 127.0.0.1 and caused the interface to lock up. If you have to do ifconfig lo0 down and up each time, there must be something that's breaking it in the first place. I'd have to be more familiar with your system to try to correlate what's happening to the server at the time the problem pops up, and see if there's a pattern to lock on to. The fact that it happens to several of your servers provides a commonality that may help in troubleshooting.

If you run only ifconfig lo0 before doing anything, is the interface showing up or down before you re-enable it?
Gan Hong Chong
New Member

Re: Cannot ping localhost (127.0.0.1)

1) /etc/nsswitch.conf contain:

hosts: files [NOTFOUND=continue] dns

2) # nslookup localhost
Using /etc/hosts on:

looking up FILES
Name: localhost
Address: 127.0.0.1
Aliases: loopback

3) Need to check on ifconfig lo0 show what next time issue occurs. I think it will not show the status of up or down
Bharat Katkar
Honored Contributor

Re: Cannot ping localhost (127.0.0.1)

Hi,
Did you unknowingly used the same address somewhere else? May be for any secondary interface or so?
Secondly, you may have any control character or any junk character (which is not visible) present in /etc/hosts file. Recreate the host file again and see if it works.

Regards,


You need to know a lot to actually know how little you know