cancel
Showing results for 
Search instead for 
Did you mean: 

Name resolution question

 
SOLVED
Go to solution
Santos Vega
Occasional Advisor

Name resolution question

Hi all,

 

I want a system only resolves by files, so I have left "/etc/nsswitch.conf" as below:

 

hosts:files

When I nslookup as root , the behaviour is the expected: "Using /etc/hosts on: ...". But, when I try with another user it reads "/etc/resolv.conf", because it resolves by DNS, not by files as stated in "/etc/nsswitch.conf" . What can be the reason for  this?

 

Regards,

4 REPLIES 4
Matti_Kurkela
Honored Contributor

Re: Name resolution question

Perhaps your /etc/nsswitch.conf is not readable by that user?

 

MK
Santos Vega
Occasional Advisor

Re: Name resolution question

Hi,

 

Yes, it was not readable (600 permissions). What I did was rename "/etc/resolv.conf".  Now "/etc/nsswitch.conf" is 444, but my question is: If user cannot read "/etc/nsswitch.conf" , why does it resolve by DNS and not by files? 

 

Regards,

Matti_Kurkela
Honored Contributor
Solution

Re: Name resolution question

If the process cannot read /etc/nsswitch.conf when it starts up, it uses HP-UX built-in defaults, which for IPv4 hostname resolution are: first DNS, then NIS, then files = /etc/hosts. If DNS or NIS reports that a host does not exist, next sources are not tried (i.e. [NOTFOUND=return] is in effect). This is documented in the nsswitch.conf man page.

 

For IPv6-aware processes on 11.23 and newer, the "ipnodes"  line in /etc/nsswitch.conf is typically used instead of "hosts" - even for looking up IPv4 hostnames. The defaults for "ipnodes" omit NIS, but are otherwise identical to the defaults of "hosts".

 

At least on 11.23, the man page says: "The library functions contain compiled-in default entries that are used if the appropriate entry in nsswitch.conf is absent or syntactically incorrect" but in fact the defaults will also be used if /etc/nsswitch.conf is not readable for any reason.

 

MK
Santos Vega
Occasional Advisor

Re: Name resolution question

Ok, thank you very much for your help !

 

Regards,