LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to setup nslookups, queries using /etc/hosts as the default (https://www.linuxquestions.org/questions/linux-server-73/how-to-setup-nslookups-queries-using-etc-hosts-as-the-default-654882/)

cornsnap 07-10-2008 10:55 AM

How to setup nslookups, queries using /etc/hosts as the default
 
Hello,

I am trying to setup so my server uses /etc/hosts as the default lookup method before DNS. I've changed /etc/nsswitch.conf (files dns) order but it doesn't work. Any other ideas?

thanks.

mknirsch 07-10-2008 11:09 AM

dns with hosts.conf
 
Hi,
when I get you right you are looking for
/etc/hosts.conf

Insert or uncomment the entry

server=local,bind

This statements specifies a server program that inquires for a name or address to first look into /etc/hosts and then use NIS bind.

cheers

Martin

cornsnap 07-10-2008 11:20 AM

host.conf
 
Thanks. I added this to the host.conf, it now looks like this:
Do I need to reboot or reread these files as it still looks at DNS first.
order hosts,bind
server=local,bind

rajwinder 07-10-2008 05:08 PM

I doubt that u can force nslookup to use /etc/hosts file. dig can i think . or try "getent" which is used to read diff DB like passwd and hosts.. but lets say what experts needs to say

Mr. C. 07-10-2008 08:21 PM

nslookup performs its own resolving, and does not/will not uses /etc/hosts.

Also learn about /etc/nsswitch.conf


All times are GMT -5. The time now is 10:16 PM.