Operating System - HP-UX
1761310 Members
3641 Online
108901 Solutions
New Discussion юеВ

Re: "localhost" is an unknownhost

 
Bennett Hunter
New Member

"localhost" is an unknownhost

Hi,

I have an HP-UX 10.20 machine, and I am trying to ping the local machine with "ping localhost". The system responds with "unknownhost localhost". I verified that the /etc/hosts file has the following line:

127.0.0.1 localhost loopback

I can't figure out why this ping command fails. This needs to work because an application uses the localhost alias, and it is giving me errors because "localhost" is an unknown host. Please help!!

Thanks,

Bennett Hunter
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: "localhost" is an unknownhost

Hi:

Does your /etc/nsswitch.conf file specify the local hosts file? For instance, if you are using DNS, you should have an entry that looks like: "files [NOTFOUND=continue] dns".

...JRF...
Bennett Hunter
New Member

Re: "localhost" is an unknownhost

James,

Thanks for your reply. The nsswitch.conf file didn't exist, but I created it earlier with the following line (I'm not sure if it is needed):

hosts: dns[NOTFOUND=continue UNAVAIL=continue]files

I will add the line that you mentioned to see if it works.



Darrel Louis
Honored Contributor

Re: "localhost" is an unknownhost

Bennett,

Was this working before.
Check with netstat -rn:


See attachment.
Bennett Hunter
New Member

Re: "localhost" is an unknownhost

It's working. I had to add the following line to the nsswitch.conf file:

hosts: files [NOTFOUND=continue] dns


Thanks for the help!