Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 07-10-2008, 10:55 AM   #1
LQ Newbie
Registered: Mar 2007
Posts: 5

Rep: Reputation: 0
How to setup nslookups, queries using /etc/hosts as the default


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?

Old 07-10-2008, 11:09 AM   #2
Registered: Feb 2003
Location: Germany
Distribution: SLES, SuSe, Ubuntu, HPUX
Posts: 38

Rep: Reputation: 18
dns with hosts.conf

when I get you right you are looking for

Insert or uncomment the entry


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


Old 07-10-2008, 11:20 AM   #3
LQ Newbie
Registered: Mar 2007
Posts: 5

Original Poster
Rep: Reputation: 0

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
Old 07-10-2008, 05:08 PM   #4
LQ Newbie
Registered: Jun 2008
Posts: 21

Rep: Reputation: 15
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
Old 07-10-2008, 08:21 PM   #5
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 62
nslookup performs its own resolving, and does not/will not uses /etc/hosts.

Also learn about /etc/nsswitch.conf


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
hostname, fqdn, /etc/hosts setup [GOD]Anck Slackware 9 07-20-2010 04:51 PM
setup domains in /etc/hosts tommy916 Linux - Networking 1 07-28-2006 05:19 PM
webalizer setup for virtual hosts intranet_man Linux - Security 1 03-03-2005 12:00 PM
How to setup virtual hosts for a web site? George2 Linux - Software 4 10-21-2003 03:46 AM
nslookups with BIND dunkyb Linux - Software 3 05-19-2003 08:10 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration