Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Solaris 8 nslookup problem

Status
Not open for further replies.

wtrepani

MIS
May 30, 2002
93
US
All,

Interesting problem on Solaris 8. When you do a nslookup, it doesn't look at local files at all. /etc/nsswitch.conf is set up for hosts to look at files then dns. It is going straight to dns. The /etc/netconfig file has ' - ' for all the nametoaddr_libs for the inet transports, so that should make it reference /etc/nsswitch.conf. Ping does work however, so it must be hitting files for that. I tried copying over another nsswitch.dns file (the default one) to eliminate any possibiliy of incorrect white space, etc, to no avail.

Anyone have any ideas?

Thanks

Will
 
It is my understanding that nslookup only uses name servers. Hence the name "name server lookup". If there is a way to make it use files, it is beyond me...
 
On HP, if you define in /etc/nsswitch.conf a hosts line that reads 'hosts: files dns', then you can watch the following happen:

ON HPUX 11
dpywaux1:/users/warsaw/wtrepani # nslookup ncsusranadc1
Using /etc/hosts on: dpywaux1

looking up FILES
Trying DNS
Name: ncsusranadc1.na.jnj.com
Address: 10.28.10.24

dpywaux1:/users/warsaw/wtrepani #

I wouldn't imaging that much difference between nslookup on two different platforms. While looking at the man pages, it talks about using NIS, local hosts files, and dns. It just doesn't go into a lot of detail about how to make it use one source or the other.

thanks

Will
 
bpinos is correct. Ping will use gethostbyname() which looks at nsswitch.conf first then calls files, NIS, NIS+, DNS as appropriate. Nslookup on the other hand doesn't since it is purely a DNS debugging tool. HP, I think, are unique in that their version of nslookup has been modified t consult nsswitch.conf.

You can use 'getent hosts <name>' which calls gethostbyname() and so works for all naming schemes and should give you what you want.
 
All,

I apologize, as I typed my reply, I thought I was logged onto a sun box, but I was actually reading the man page from HP. I went back and looked at the man page for sun, and it doesn't reference files at all.

Thanks to all for clearing this up for me.

Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top