cache-only named won't resolve "localhost"

Gary W. Swearingen garys at opusnet.com
Tue Aug 16 20:19:56 GMT 2005


Chuck Swiger <cswiger at mac.com> writes:

> 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:

Apparently so.  I've sorta followed your suggestions and used the
following rather verbose master/localhost with good results (except
Mozilla).  You needn't read further; I've just added some observations.


$TTL 604800

localhost.       IN      SOA     localhost. root.localhost. (
                        20050816         ; Serial
                          604800         ; Refresh
                           86400         ; Retry
                         2419200         ; Expire
                          604800 )       ; Minimum
;Name Server:
localhost.    IN    NS    localhost.

;Host Address:
localhost.    IN    A     127.0.0.1

;Host Alias:
localhost.localhost.    IN    CNAME    localhost.

; The End.


Now "host", "dig", and "nslookup" work OK, even without an
/etc/resolv.conf file.  But sendmail seems to need the later.
(It just has "nameserver 127.0.0.1".)

I tried to make "localhost.localhost" the canonical domain and
"localhost." the alias (so it would better correspond to the
reverse mapping which has 127.0.0.1 > localhost.localhost.), but
it then wouldn't resolve "localhost" OR "localhost.localhost".

My DNS book implies taht any domain name can be assigned to a host, as
it can with the CNAME above, but it seems that important software
either insists that a host has a two-part domain name or chokes on a
FQDN like "localhost.", which ends with a dot.  So be it.


Mozilla apparently doesn't even use my local DNS as it still hangs.
(I must admit that I've never checked my caching DNS's cache.)

I know little about proxies, but I tried configuring Mozilla to use a
"localhost" proxyand it then resolved "localhost" OK, but my funky
python-only web server couldn't find the index.html it found with
127.0.0.1.  Oh well, I don't much care about Mozilla problems as long
as I can work around it, which I can.

Thanks.


More information about the freebsd-questions mailing list