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: Leslie Clark <lclark@us.ibm.com>
Date: Thu, 23 Dec 2004 07:26:18 -0500
Delivery-date: Thu, 23 Dec 2004 12:26:50 +0000
Envelope-to: nv-l-archive@lists.skills-1st.co.uk
In-reply-to: <4.3.2.7.2.20041223121709.01719f20@pop.ozemail.com.au>
Reply-to: nv-l@lists.us.ibm.com
Sender: owner-nv-l@lists.us.ibm.com

Yes, please! I'd appreciate it.

Cordially,

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



Joe Fernandez <jfernand@kardinia.com>
Sent by: owner-nv-l@lists.us.ibm.com

12/22/2004 08:56 PM
Please respond to
nv-l

To
nv-l@lists.us.ibm.com
cc
Subject
Re: [nv-l] Re: Help with name resolution on Linux





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
http://www.kardinia.com
<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web