1748165 Members
3834 Online
108758 Solutions
New Discussion юеВ

Re: nslookup

 
SOLVED
Go to solution
Clay_Chappell
Occasional Advisor

nslookup

How can nslookup function (access DNS) if there is no /etc/nsswitch.conf file?
I have multiple HP-UX servers (11i and 11iv2)
Some with nsswitch.conf, some without.
Presense of nsswitch.conf seems to change nothing.
Some have the DNS server in their /etc/hosts,
some do not.
Adding or removing DNS server from /etc/hosts seems to change nothing.
One server has no nsswitch.conf, no DNS entry in /etc/hosts, but for "sys" group users, nslookup works fine.
Not for anyone else.
ftp doesn't resolve the same as nslookup
traceroute resolves fine for everyone.
ping resolves fine for everyone.
3 REPLIES 3
Shibin_2
Honored Contributor

Re: nslookup

/etc/nsswitch.conf defines the policy for nslookup. Whether the command to be looked up files or dns or nis etc.

Alternatively, you can specify all these info in .nslookuprc file in user's home directory using set command.

Read man pages.

man nslookup.
Regards
Shibin
Patrick Wallek
Honored Contributor
Solution

Re: nslookup

If no /etc/nsswitch.conf is present on the system, then there are default policies that are used by the system. According to the nslookup man page:

The library functions contain compiled-in default entries that are used if the appropriate entry in nsswitch.conf is absent or
syntactically incorrect. The entries are as follows:
[...]
hosts: dns [NOTFOUND=return] nis [NOTFOUND=return] files
[...]

So, that explains part of the behavior.

The other part of the equation is the /etc/resolv.conf file. The DNS servers that are used to look up host info are specified there.

The DNS server being in the /etc/hosts file will not accomplish much.

>>One server has no nsswitch.conf, no DNS
>>entry in /etc/hosts, but for "sys" group
>>users, nslookup works fine.

I suspect in this case that you have an /etc/resolv.conf file and that the permissions allow reading of the file by the owner and group, which are probably root and sys respectively (the defaults).

To resolv this, you need to make the file world READable (you don't need world write or world execute).

chmod o+r /etc/resolv.conf

Clay_Chappell
Occasional Advisor

Re: nslookup

I'll give you a 9 for effort, but you were too slow.
We discovered the permission error on /etc/resolv.conf just moments before you responded