cancel
Showing results for 
Search instead for 
Did you mean: 

Name Resolution

Jim Booker
Advisor

Name Resolution

nsswitch.conf contains:
hosts: files nisplus dns

When I try to resolve a host name
that is NOT in dns, but is in my
/etc/host file, resolution fails. I don't
think nslookup ever looks at the
/etc/host file. Anyone know how to
insure the /etc/host file is looked at?
2 REPLIES
Jim Booker
Advisor

Re: Name Resolution

Additional information - RedHat 7.2
I am using a static ip address.
I have tried moving resolv.conf to a
different name.
Kodjo Agbenu
Honored Contributor

Re: Name Resolution

Hello,

Of sure, on linux's nslookup is unable to check /etc/hosts.

There are 2 ways to make the system use /etc/hosts first :

-> /etc/nsswitch.conf : your syntax is correct.

-> /etc/host.conf : it depends on the libc you are using. Normally, it should contains something like :

order hosts,bind
multi on


To check whether your /etc/hosts is actually used or not, put a fake entry in it, using an IP that is currently up and available on your network, and using a hostname for which you are sure DNS is not going to reply. Example :

192.168.1.1 fakehost

Then, try to ping fakehost : if it replies, then you are sure /etc/hosts have been used.


If you want more help, please describe exactly the tests you did and the problem you have with name resolution.

Good luck.

Kodjo
Learn and explain...