localhost and rndc.conf in BIND 9

Simon Waters Simon at wretched.demon.co.uk
Tue Dec 31 13:22:00 UTC 2002


Jun Wang wrote:
> 
> I am using BIND 9 and wondering in which zone file I
> can put "localhost" record, even I have it in
> /etc/hosts? For example:
> localhost.   IN    A    127.0.0.1

"localhost." belongs in the root zone so "you" probably can't
put it there.

> I am asking this because "nslookup localhost." would
> fail, while when using BIND 8, I did not have this
> problem and I did not have "localhost" record either.

You should have a "localhost IN A 127.0.0.1" in each zone that
client machines are in, this with resolve "localhost" enquiries,
you shouldn't have client machines needing to do the equivalent
of "nslookup localhost.".

> Also, this failure seems to lead to another problem,
> in the rndc.conf, when I first used "localhost" in the
> "options" statement, rndc would report connect
> failure. After I used "127.0.0.1" instead, rndc can
> run without any problems.

Use 127.0.0.1 then ;-)

"localhost" has a reserved meaning only in "address-lists", not
where "ip-addr" is expected, see Chapter 6 of the ARM for syntax
of zone files.

In an address-list "localhost" does not mean "127.0.0.1", but
any local address.


More information about the bind-users mailing list