[PLUG] Resolver going to DNS for private IP reverse lookups, flagrantly ignoring /etc/hosts?

Marvin J. Kosmal lamsokvr at xprt.net
Tue Aug 17 13:42:02 UTC 2004


On Tuesday 17 August 2004 12:56, Ian Burrell wrote:
> On Tue, Aug 17, 2004 at 11:38:00AM -0700, Randall Lucas wrote:
> > I've got some Red Hat ES2.1 (RH7.3 but not free) boxes that FTP things
> > to each other over a private IP network (eg 192.168.0.x) via an
> > automated process using Net::FTP with a 30 second timeout.
> >
> > 95% of time time, it connects super fast with no problems.
> > Non-deterministically, the other 5% or so, it times out.
> >
> > A few years ago I had a problem with a similar process -- the ftpd was
> > doing a reverse lookup and going out to DNS to do so.  I'm afraid it may
> > be doing this again.
> >
> > I have the private IPs listed in /etc/hosts, but when I use "host
> > 192.168.0.1", it goes out to DNS and either times out or gives me:
> >
> > Host 1.0.168.192.in-addr.arpa not found: 3(NXDOMAIN)
> >
> > The resolver shouldn't be going to DNS at all for that IP -- it's in my
> > /etc/hosts and I've got order hosts,bind in my /etc/host.conf.  (For the
> > record, the hosts can and do get out to the internet for DNS lookups).
> >
> > Is there something I'm doing wrong with this?  I plan to change the
> > process to use scp but it's unsettling that venerable and standard tools
> > aren't working.
>
> First, host only does DNS lookups.  It is the simple version of dig.
> The DNS resolver only looks at /etc/resolv.conf.
>
> /etc/host.conf controls where gethostbyname looks.  Unluckily, there
> is no standard utility for doing queries with gethostbyname.
> /etc/nsswitch.conf is the newer file for controlling where to look.  I
> am not sure how they interact but my impression is that latter takes
> precedence.  What does the hosts: line /etc/nsswitch.conf look like?
>
> Also, make sure the syntax in /etc/hosts is correct.  I have seem
> problems when this is not right.  It should look like:
>
> 192.168.1.10 hostname hostname.domain

Actually

  IP_address canonical_hostname aliases


EXAMPLE
        127.0.0.1       localhost
        192.168.1.10    foo.mydomain.org  foo
        192.168.1.13    bar.mydomain.org  bar
        216.234.231.5   master.debian.org      master
        205.230.163.103 www.opensource.org

HTH


Marv

>
>  - Ian





More information about the PLUG mailing list