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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nslookup does not use local /etc/hosts file

Status
Not open for further replies.

Stumpr

Technical User
Jan 2, 2004
1,178
US


What needs to be in place for nslookup to use the local /etc/hosts file before using the nameserver

/etc/nsswitch.conf
hosts: files dns

does not work. There must be something else I need to set up.

Bob Stump
Just because the VERITAS documentation states a certain thing does not make it a fact and thats the truth
 
Stumpr;

This is what I found from O'Reilly DNS and Bind fourth edition.

12.1.5. Using NIS and /etc/hosts
This last point doesn't compare nslookup to the resolver or name server but to ways of looking up names in general. As distributed from the Internet Software Consortium, nslookup uses only DNS; it won't use NIS or /etc/hosts. Most applications can use DNS, NIS, or /etc/hosts, depending on how the system is configured. Don't count on nslookup to help you find your lookup problem unless your host is really configured to use name servers.[93]

[93]Or your vendor's nslookup has been enhanced to query NIS servers and check /etc/hosts, like the one in HP-UX.

thanks

CA
 
To look up hostnames using all databases from /etc/nsswitch.conf in the configured order you could do a
Code:
getent hosts <hostname>
.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top