Summary: DNS lookup order

From: A. Mahendra Rajah, Systems Manager <A.Mahendra.Rajah_at_Meena.CC.URegina.CA>
Date: Wed, 02 Jun 1999 13:33:46 -0600 (CST)

                    
   I asked in this list the following 2 questions:

   1. How to make sure that all nameserver lookups will consult the
       /etc/hosts file first, and
   2. Why only the first server listed in /etc/resolv.conf file is
       contacted for nameserver lookups.

   I received 4 replies. My sincere thanks to:

        Mike Iglesias <iglesias_at_draco.acs.uci.edu>
        "John F. Marten" <root_at_tigger.oslc.org>
        wmills_at_WellsFargo.COM
        Gary Gladney <gladney_at_stsci.edu>

   Mike answered question #2:

       That is the way it works. The first nameserver is consulted, and
       if it is not available, the others are tried in the order given in
       /etc/resolv.conf. If the first nameserver cannot properly resolve
       names, it should not be used.


   For question #1:

   John wrote:

       i'm not sure DU looks at /etc/hosts anymore although i keep mine
       around just in case ;>) . anyway make sure your hosts/servers are
       listed in the /etc/namedb/hosts.db file.

   Gary wrote:

       You have the setup right. If you are using nslookup to check,
       you will notice that nslookup only uses DNS. It's a DNS tool,
       don't mean to sound ignorant. Try using telnet instead and
       change the address of a host in your hosts file and see if it
       still works.

   wmills wrote:

       Is it possible that your hosts file is somehow corrupt? That
       would be my first guess.

   Gsry's answer hit it on the nail. Nameserver lookups use DNS and
   hence _will_ go to a nameserver. But, telnet, ping, et al will
   happily consult the /etc/hosts file first.
       
   What was my problem? I have several short-form names in /etc/hosts
   file for the hosts that are not listed in the DNS tables. These
   names should be separated by spaces and not commas as I had.
   
        ###.###.###.### host.domain host1,host2,host3

   is INcorrect.

        ###.###.###.### host.domain host1 host2 host3

   is correct and it works.

   Cheers and thanks to the four kind persons who answered my query.



   -- mahendra
.........................................................................
   A. Mahendra Rajah Email: Mahendra_at_Meena.CC.URegina.CA
   VMS & DUNIX Systems Manager Phone: (306) 585-4496
   Dept. of Computing Services FAX: (306) 585-5060
   University of Regina,
   Regina, Sask., S4S 0A2
   Canada.
.........................................................................
Received on Wed Jun 02 1999 - 19:41:18 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:39 NZDT