Showing results for 
Search instead for 
Did you mean: 

NSSWITCH conf file.

Go to solution
Narendra Uttekar
Regular Advisor

NSSWITCH conf file.


We were having problem with DNS server and because of that we were not able to ping the localhost. But we have already added localhost entry in /etc/hosts file. And also we have set the search preference in  /etc/nsswitch.conf as files first and then to look DNS.


So trying to understand why it was looking for DNS for localhost ping as it was already in /etc/hosts file. But after DNS server problem was fixed we were able to ping the localhost.


Please find the /etc/nsswitch.conf and /etc/resolv.conf file entries as below and let me know how we can fix this problem. As later on again if we had similar problem with DNS server it should have resolved through /etc/hosts file and no need to look to resolve through DNS for localhost.


server1:/# ping localhost

PING 64 byte packets PING Statistics----

10 packets transmitted, 0 packets received, 100% packet loss


server1:/# cat /etc/nsswitch.conf
passwd:       compat
group:        compat
hosts:        files [NOTFOUND=continue] dns
ipnodes:      dns [NOTFOUND=return] nis [NOTFOUND=return] files
networks:     nis [NOTFOUND=return] files
protocols:    nis [NOTFOUND=return] files
rpc:          nis [NOTFOUND=return] files
publickey:    nis [NOTFOUND=return] files
netgroup:     nis [NOTFOUND=return] files
automount:    files nis
aliases:      files nis
services:     nis [NOTFOUND=return] files


server1:/# cat /etc/resolv.conf
domain company.pvt
nameserver 10.x.x.x

nameserver 10.x.x.x





P.S. This thread has been moved from HP-UX>System Administration to  HP-UX > networking. -HP Forum Moderator

Patrick Wallek
Honored Contributor

Re: NSSWITCH conf file.

I think your problem may be related to the 'ipnodes' line in your nsswitch.conf file.  This line can also have an impact on how things are looked up.


Both the hosts line and the ipnodes line should be the same.  So, I would change the ipnodes line so that it looks like:


ipnodes:      files [NOTFOUND=continue] dns