Operating System - HP-UX
1752806 Members
5957 Online
108789 Solutions
New Discussion юеВ

Re: /etc/nssswitch.conf file entry

 
gany59
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

6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: /etc/nssswitch.conf file entry

Hi:

> 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?

Correct.

Regards!

...JRF...
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
SoorajCleris
Honored Contributor

Re: /etc/nssswitch.conf file entry

Hi,

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.

Regards,
Sooraj
"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.

and
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.

BR,
Kapil+
I am in this small bowl, I wane see the real world......
bullz
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
R.O.
Esteemed Contributor

Re: /etc/nssswitch.conf file entry

Hi,

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

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