From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079044115508.tru64-unix-managers.marc@archive.invalid> From: "A. Mahendra Rajah, Systems Manager" Date: Wed, 02 Jun 1999 19:33:46 +0000 To: tru64-unix-managers Subject: Summary: DNS lookup order X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079044115508 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 "John F. Marten" wmills@WellsFargo.COM Gary Gladney 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@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. .........................................................................