Question about defining localhost inside of DNS

Kevin Darcy kcd at daimlerchrysler.com
Fri Apr 6 20:59:45 UTC 2001


Michael Steeves wrote:

> I'm working on setting up BIND 9.1.1, and one question I had was if
> there's any point to putting the entry for localhost in anywhere.
> I've set up the 0.0.127.in-addr.arpa domain, but if I query the
> nameserver for 'localhost', it fails at the root level name servers.

The 0.0.127.in-addr.arpa domain and the resolution of the name
"localhost" really have nothing to do with each other. If you want
"localhost" to resolve, then you need to define it in the root zone (if
you have an internal root), or you need to define it in whatever zone
that your resolver(s) will search, e.g. if you have "domain
example.com" in your /etc/resolv.conf, then "localhost" will resolve if
there is a "localhost.example.com" A record in DNS. Whether 127.0.0.1
reverse-resolves back to the *same* name is, as I said, unrelated.

> Is there any point to defining this?  My sense of completeness wants
> to define it *somewhere* in DNS, but I'm not sure if a) this is even a
> good idea, and b) if so where to do it.

Personally, I've never found much use for putting "localhost" into DNS.
If it's necessary at all, remember that most resolvers will fail over to
other naming sources -- e.g. the /etc/hosts file -- if they don't find a
name in DNS. So, having a "127.0.0.1 localhost" entry in every machine's
/etc/hosts file should suffice (and I think most OS vendors install it
that way by default anyway).


- Kevin




More information about the bind-users mailing list