Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
Showing results for 
Search instead for 
Did you mean: 

nsswitch.compat and nsswitch.conf (points!)

Christian Deutsch_1
Esteemed Contributor

nsswitch.compat and nsswitch.conf (points!)

Hi folks,

I read in the following post (, that name resolution "default behaviour" if there is no nsswitch.conf file can be seen in /etc/nsswitch.hp_defaults (and /etc/nsswitch.compat?).

So in fact, even if no nsswitch.conf file is present, name resolution via /etc/hosts will still work, e.g. using /usr/bin/nslookup on HP-UX 11.31. However, programs using gethostbyname() may be able to "accept" a certain IP address but *not* be able to resolve the hostname, even though it is present in /etc/hosts.

So what should I expect? Is it correct to assume that every HP-UX administrator will have an nsswitch.conf file anyway to ensure that programs relying on gethostbyname() will not fail?

Informed, helpful replies will be generously rewarded with points!

Thanks, Christian
Yeshua loves you!
Laurent Menase
Honored Contributor

Re: nsswitch.compat and nsswitch.conf (points!)


Default behaviour is to try dns then /etc/hosts after a timeout

if you have no reslov.conf, the dns will be try on
So my advise:
Define exactly what you want to happen on gethostbyname in /etc/nsswitch.conf
and if you want the use of dns, then define a /etc/resolv.conf

if you don't want dns resolution it is very important to define a nsswitch.conf
rick jones
Honored Contributor

Re: nsswitch.compat and nsswitch.conf (points!)

Keep in mind that nslookup is not known for its slavish adherence to an nsswitch file.

FWIW, gethostbyname()/gethostbyaddr() is very "old school" these days - applications should be written to use getaddrinfo()/getnodeinfo().

there is no rest for the wicked yet the virtuous have no pillows