Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Aug 2005 21:49:41 -0400
From:      Chuck Swiger <cswiger@mac.com>
To:        "Gary W. Swearingen" <garys@opusnet.com>
Cc:        questions@freebsd.org
Subject:   Re: cache-only named won't resolve "localhost"
Message-ID:  <43014635.4060301@mac.com>
In-Reply-To: <mnwtmnxlrz.tmn@mail.opusnet.com>
References:  <4w1x4wyqkl.x4w@mail.opusnet.com> <43000B38.8040002@daleco.biz> <mnwtmnxlrz.tmn@mail.opusnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Gary W. Swearingen wrote:
[ ... ]
> so I'd think domain resolution should look in /etc/hosts before
> even checking my cache-only named.  Which it seems to do for "ping",
> but not for "host", "nslookup", or "mozilla".

As Lowell noted, programs like "nslookup" and "dig" are designed to query DNS 
specificly, not look into your flatfiles for hostname/IP mappings.

> I'm still wondering if I should be declaring a forward zone for
> "localhost" or "localhost.localhost"; it seems kinda strange that
> the script would set up a reverse for it, but say nothing about
> the forward.

Note that the resolver will treat lookups of "localhost." and "localhost" 
differently if you have a domain or search directive specified in 
/etc/resolv.conf.  You could and perhaps should ensure that the one ending in a 
period exists in a zone file on the nameserver, and maps via an A record to 
127.0.0.1:

;
; BIND data file for local loopback interface
;

$TTL 604800

@       IN      SOA     localhost. root.localhost. (
                               1         ; Serial
                          604800         ; Refresh
                           86400         ; Retry
                         2419200         ; Expire
                          604800 )       ; Default TTL
;
@       IN      NS      localhost.
@       IN      A       127.0.0.1

------

I inherited this from somewhere, you could remove all but the first "IN" (it 
defaults), as well as being less clever about reusing @, but add salt as 
needed. :-)

It is probably also a reasonable idea to have an A record for localhost in each 
forward zone file, so that "localhost.example.com" resolves immediately and 
stops rather than querying names throughout the search list of domains.  This 
can reduce annoying DNS delays significantly in a number of circumstances, not 
the least of which are client machines with less-than-brillant resolver 
routines (think WinNT 4).

Oh, yeah, this all was prompted by the notion that some other programs, such as 
squid in particular, also use their own resolver routines like "nslookup" does. 
  But Mozilla ought to pay attention to /etc/hosts.  The connection between 
these two is that you could uncouple mozilla from doing it's own DNS by 
pointing at a proxy server for testing what is going on....

-- 
-Chuck




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43014635.4060301>