HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
Showing results for 
Search instead for 
Did you mean: 

/etc/nssswitch.conf file entry

Regular Advisor

/etc/nssswitch.conf file entry

Hi Folks,

I have a small concern in the entry for the /etc/nssswitch.conf file
In one of the server i am getting the entry as below :

-bash-2.05b$ more /etc/nsswitch.conf
hosts: files [NOTFOUND= continue] dns

so the meaning for this is for the hostname it needs to check first the /etc/hosts file, if the entry is not there, the checking continues to the dns server right?

pls let me know this..

Thanks in advance

James R. Ferguson
Acclaimed Contributor

Re: /etc/nssswitch.conf file entry


> so the meaning for this is for the hostname it needs to check first the /etc/hosts file, if the entry is not there, the checking continues to the dns server right?



rick jones
Honored Contributor

Re: /etc/nssswitch.conf file entry

If you are running 11.31 and have some things that do not appear to be following those instructions, see about copying the "hosts" line to one for "ipnodes" for example:

ipnodes: files [NOTFOUND= continue] dns

It might be that the apps using getaddrinfo() rather than gethostbyname() are getting a "default" behaviour. FWIW, any application being maintained or developed these days probably should be converted to getaddrinfo()/getnodeinfo() and stop using gethostbyname()/gethostbyaddr(). This would be one of the first steps for being IPv6 ready. I've also found getaddrinfo() to be more convenient even for IPv4.
there is no rest for the wicked yet the virtuous have no pillows
Honored Contributor

Re: /etc/nssswitch.conf file entry


Your query and assumption is correct.

The file /etc/nsswitch* is used for ruling the name resolution procedure ( and there are other usage also).

The host is not available in files say /etc/hosts , it will go to cnfigured dns server.

"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity" - Dennis Ritchie
Kapil Jha
Honored Contributor

Re: /etc/nssswitch.conf file entry

man nsswitch.conf

Source Uses
files /etc/hosts, /etc/passwd, and so forth
nis NIS (YP)
nisplus NIS+
ldap LDAP Directory Server
dns Valid only for hosts, ipnodes; uses the Internet Domain Name Service.

Status Meaning
SUCCESS Requested database entry was found
UNAVAIL Source is not responding or corrupted
NOTFOUND Source responded "no such entry"
TRYAGAIN Source is busy, might respond to retries

Action Meaning
continue Try the next source in the list
return Return now


UNIX checks this file on how to get various information from various files.

I am in this small bowl, I wane see the real world......
Super Advisor

Re: /etc/nssswitch.conf file entry

Yes, but what's mean if below one then?

hosts: files dns

This also, the same funtion i guess.
It will search it in /etc/hosts, if not found it will search it in DNS
Esteemed Contributor

Re: /etc/nssswitch.conf file entry


Yes, it will check "/etc/hosts" and if it does not found the entry there, it will try dns.

"When you look into an abyss, the abyss also looks into you"