nv-l
[Top] [All Lists]

Re: [nv-l] Re: Help with name resolution on Linux

To: nv-l@lists.us.ibm.com
Subject: Re: [nv-l] Re: Help with name resolution on Linux
From: Joe Fernandez <jfernand@kardinia.com>
Date: Thu, 23 Dec 2004 12:56:56 +1100
Delivery-date: Thu, 23 Dec 2004 02:05:30 +0000
Envelope-to: nv-l-archive@lists.skills-1st.co.uk
In-reply-to: <OFF9F8A688.08676FB9-ON85256F71.00644083-85256F71.006456FB@ us.ibm.com>
References: <OF3E863525.50C0D183-ON85256F71.004FE838-85256F71.005E3785@LocalDomain>
Reply-to: nv-l@lists.us.ibm.com
Sender: owner-nv-l@lists.us.ibm.com
At 01:19 PM 21-12-04 -0500, you wrote:
Has anyone encountered this? I'm trying to override DNS with /etc/hosts. It appears that you do this in /etc/nsswitch.conf and /etc/host.conf on Linux, similar to Solaris. And the host command behaves differently than it does on AIX - it always checks only dns, like nslookup. The same with the 'dig' command. So it is tricky to verify just what is going on. It appears to me that it works for forward resolution, but not for backward resolution.

That is,  gethostbyname  respects the order that you set in nsswitch.conf
     hosts:  files dns
and in /etc/host.conf
     order hosts, bind
     multi on
but gethostbyaddr does not.

Suggestions welcome.
Cordially,
Leslie A. Clark
IBM Global Services - Systems Mgmt & Networking
(248) 552-4968 Voicemail, Fax, Pager

Leslie,

I believe "dig" is meant to only look up the DNS.

On the other hand, both gethostbyname and gethostbyaddr will do a search in the order you specify in the nsswitch.conf and host.conf files as you  list above.

I ran a check on one of our Red Hat systems.

1. The default settings of the conf files were as you have them above, without the "multi on"
2. I executed a gethostbyname on www.ibm.com, got a list of IP addresses, picked one and issued a gethostbyaddr and got back www.ibm.com
3. I made an entry in the hosts file defining www.ibm.com as 10.1.1.1
4.  I executed a gethostbyname on www.ibm.com, got 10.1.1.1, executed a gethostbyaddr on 10.1.1.1 and got back www.ibm.com
5. I reversed the order in the conf files, repeated the previous step and got the results of step 2 rather than step 4.

This suggests to me that both gethostbyname and gethostbyaddr  take their order from the conf files....at least on this system.

I can send you the command line program I used to test it, if it is of use to you.


Joe Fernandez
Kardinia Software
jfernand@kardinia.com
<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web