Unix Technical Forum

hosts seems to not be used by the resolver

This is a discussion on hosts seems to not be used by the resolver within the Linux Operating System forums, part of the Unix Operating Systems category; --> hello, We have two environments, one for test and one for the production. Because our applications need the hostname ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-18-2008, 06:23 PM
xi@videotron.ca
 
Posts: n/a
Default hosts seems to not be used by the resolver

hello,

We have two environments, one for test and one for the production.

Because our applications need the hostname in a lot of configuration
files, we choose to leave the hostname of the production server in the
configuration of the test environment. Therefore, to resolve the ip
address to the proper server we have an entry in a DNS server to
resolve for the production server. For the test environment, we
defined an entry like "11.22.33.44 prodsrv" in /etc/hosts and we
have "hosts: files dns" in the file /etc/nsswitch.conf.

Now, on our test server when we do `nslookup prodsrv`, it gives us the
ip address of the production server rather than the address of the test
server.

How come nslookup on the test server does not resolve to the ip address
of test server? What could be wrong?

Our linux distro is SuSE version 9 patchlevel 2.

Thanks in advance,
Bernard

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-18-2008, 06:23 PM
Dave Uhring
 
Posts: n/a
Default Re: hosts seems to not be used by the resolver

On Thu, 03 Aug 2006 11:39:02 -0700, x wrote:

> Now, on our test server when we do `nslookup prodsrv`, it gives us the
> ip address of the production server rather than the address of the test
> server.


nslookup does not refer to the /etc/hosts file.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-18-2008, 06:23 PM
Nico Kadel-Garcia
 
Posts: n/a
Default Re: hosts seems to not be used by the resolver

Dave Uhring wrote:
> On Thu, 03 Aug 2006 11:39:02 -0700, x wrote:
>
>> Now, on our test server when we do `nslookup prodsrv`, it gives us
>> the ip address of the production server rather than the address of
>> the test server.

>
> nslookup does not refer to the /etc/hosts file.


This is exactly why DNS and /etc/hosts should never be allowed to *conflict*
in their information for the same hosts or IP addresses. Tools which use one
source of data will argue with the other.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-18-2008, 06:23 PM
Unruh
 
Posts: n/a
Default Re: hosts seems to not be used by the resolver

xi@videotron.ca writes:

>hello,


>We have two environments, one for test and one for the production.


>Because our applications need the hostname in a lot of configuration
>files, we choose to leave the hostname of the production server in the
>configuration of the test environment. Therefore, to resolve the ip
>address to the proper server we have an entry in a DNS server to
>resolve for the production server. For the test environment, we
>defined an entry like "11.22.33.44 prodsrv" in /etc/hosts and we
>have "hosts: files dns" in the file /etc/nsswitch.conf.


>Now, on our test server when we do `nslookup prodsrv`, it gives us the
>ip address of the production server rather than the address of the test
>server.


nslookup is the wrong tool. Its whole purpose is to query dns servers.
Do
ping prodsrv
and look at the address used if you want to see if something uses
/etc/hosts.


>How come nslookup on the test server does not resolve to the ip address
>of test server? What could be wrong?


>Our linux distro is SuSE version 9 patchlevel 2.


>Thanks in advance,
>Bernard


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-18-2008, 06:23 PM
Unruh
 
Posts: n/a
Default Re: hosts seems to not be used by the resolver

"Nico Kadel-Garcia" <nkadel@comcast.net> writes:

>Dave Uhring wrote:
>> On Thu, 03 Aug 2006 11:39:02 -0700, x wrote:
>>
>>> Now, on our test server when we do `nslookup prodsrv`, it gives us
>>> the ip address of the production server rather than the address of
>>> the test server.

>>
>> nslookup does not refer to the /etc/hosts file.


>This is exactly why DNS and /etc/hosts should never be allowed to *conflict*
>in their information for the same hosts or IP addresses. Tools which use one
>source of data will argue with the other.


Only if they are allowed into the same room together. Why would anyone use
nslookup for anything except giving information to a human?



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-18-2008, 06:23 PM
Nico Kadel-Garcia
 
Posts: n/a
Default Re: hosts seems to not be used by the resolver

Unruh wrote:
> "Nico Kadel-Garcia" <nkadel@comcast.net> writes:
>
>> Dave Uhring wrote:
>>> On Thu, 03 Aug 2006 11:39:02 -0700, x wrote:
>>>
>>>> Now, on our test server when we do `nslookup prodsrv`, it gives us
>>>> the ip address of the production server rather than the address of
>>>> the test server.
>>>
>>> nslookup does not refer to the /etc/hosts file.

>
>> This is exactly why DNS and /etc/hosts should never be allowed to
>> *conflict* in their information for the same hosts or IP addresses.
>> Tools which use one source of data will argue with the other.

>
> Only if they are allowed into the same room together. Why would
> anyone use nslookup for anything except giving information to a human?


Because nslookup is hardly the only thing that does DNS checking. Take a
look at the contents of your /etc/nsswitch.conf to see if it's actually set
to use "files" or "dns" first: then look what happens if you change the
order around, then add "nis" with the automatic or semi-automatic
configuration tools and your order gets messed up. Then look at tools like
SSH that do reverse DNS lookups and watch the craziness *they* create when
you wind up with two IP addresses corresponding to the same hostname.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-18-2008, 06:23 PM
xi@videotron.ca
 
Posts: n/a
Default Re: hosts seems to not be used by the resolver


Unruh wrote:
> xi@videotron.ca writes:
>
> >hello,

>
> >We have two environments, one for test and one for the production.

>
> >Because our applications need the hostname in a lot of configuration
> >files, we choose to leave the hostname of the production server in the
> >configuration of the test environment. Therefore, to resolve the ip
> >address to the proper server we have an entry in a DNS server to
> >resolve for the production server. For the test environment, we
> >defined an entry like "11.22.33.44 prodsrv" in /etc/hosts and we
> >have "hosts: files dns" in the file /etc/nsswitch.conf.

>
> >Now, on our test server when we do `nslookup prodsrv`, it gives us the
> >ip address of the production server rather than the address of the test
> >server.

>
> nslookup is the wrong tool. Its whole purpose is to query dns servers.
> Do
> ping prodsrv
> and look at the address used if you want to see if something uses
> /etc/hosts.
>
>


Thanks! I didn't know nslookup and host, for that matter, does not use
the hosts file. ping confirmed the resolution was as requested.
Everything works smoothly now.

Thanks,
Bernard

> >How come nslookup on the test server does not resolve to the ip address
> >of test server? What could be wrong?

>
> >Our linux distro is SuSE version 9 patchlevel 2.

>
> >Thanks in advance,
> >Bernard


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-18-2008, 06:23 PM
Unruh
 
Posts: n/a
Default Re: hosts seems to not be used by the resolver

"Nico Kadel-Garcia" <nkadel@comcast.net> writes:

>Unruh wrote:
>> "Nico Kadel-Garcia" <nkadel@comcast.net> writes:
>>
>>> Dave Uhring wrote:
>>>> On Thu, 03 Aug 2006 11:39:02 -0700, x wrote:
>>>>
>>>>> Now, on our test server when we do `nslookup prodsrv`, it gives us
>>>>> the ip address of the production server rather than the address of
>>>>> the test server.
>>>>
>>>> nslookup does not refer to the /etc/hosts file.

>>
>>> This is exactly why DNS and /etc/hosts should never be allowed to
>>> *conflict* in their information for the same hosts or IP addresses.
>>> Tools which use one source of data will argue with the other.

>>
>> Only if they are allowed into the same room together. Why would
>> anyone use nslookup for anything except giving information to a human?


>Because nslookup is hardly the only thing that does DNS checking. Take a
>look at the contents of your /etc/nsswitch.conf to see if it's actually set
>to use "files" or "dns" first: then look what happens if you change the
>order around, then add "nis" with the automatic or semi-automatic
>configuration tools and your order gets messed up. Then look at tools like
>SSH that do reverse DNS lookups and watch the craziness *they* create when
>you wind up with two IP addresses corresponding to the same hostname.


??? If you have a hosts file you had better have the order files,hosts.
Anything else would be silly. If you misuse and operating system, and it
bites you, you should not be making laws about how how others use theirs.

It is true that the new host lookup routines (which ssh uses and which are
supposed to ip6 ready)break almost everything for no discernable reason.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-18-2008, 06:23 PM
Nico Kadel-Garcia
 
Posts: n/a
Default Re: hosts seems to not be used by the resolver

Unruh wrote:
> "Nico Kadel-Garcia" <nkadel@comcast.net> writes:


>> Because nslookup is hardly the only thing that does DNS checking.
>> Take a look at the contents of your /etc/nsswitch.conf to see if
>> it's actually set to use "files" or "dns" first: then look what
>> happens if you change the order around, then add "nis" with the
>> automatic or semi-automatic configuration tools and your order gets
>> messed up. Then look at tools like SSH that do reverse DNS lookups
>> and watch the craziness *they* create when you wind up with two IP
>> addresses corresponding to the same hostname.

>
> ??? If you have a hosts file you had better have the order
> files,hosts. Anything else would be silly. If you misuse and
> operating system, and it bites you, you should not be making laws
> about how how others use theirs.
>
> It is true that the new host lookup routines (which ssh uses and
> which are supposed to ip6 ready)break almost everything for no
> discernable reason.


Then you haven't looked into SSH. SSH does forward and reverse DNS lookups,
to verify that the host claiming to be "sshclient.whatever.com" and which is
permitted to do key-based or host-based access is really, really the host
expected, and so that connections can be logged with the appropriate
hostname so you can tell where someone was connecting from. This is
especially useful in dynamic DNS setups, like Windows machines in Active
Directory and Linux boxes that register their hostnames in active DNS, so
that connections from "mylaptop.whatever.com" are listed as actually coming
from that hostname, not just the DNS.

You can't rely on that in /etc/hosts: /etc/hosts is a serious legacy of when
DNS was awkward and painful to set up, and it was easier to simply publish
an /etc/hosts for your local network than to use a DNS server. These days,
it's easy to run an internal DNS server that handles this sort of thing for
you and avoids the conflicts. It's often done by using "views", that provide
one set of A records for internal use and another set for external or DMZ
use.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:47 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com