AAAA record for localhost or not?

Bjørn Mork bjorn at mork.no
Tue Sep 18 11:13:57 CEST 2012


An interesting discussion just came up on Debian lists relating to the
odd traditional mapping they've used in /etc/hosts:

 127.0.0.1       localhost
 ::1     ip6-localhost ip6-loopback


I've always defined 

 localhost.  A    127.0.0.1
             AAAA ::1

in my local zone files, with the matching reverse zones.

But Googling for the definite RFC regulating this lead to nothing.  You
have RFC 2606 (BCP 32) reserving the "localhost" zone and RFC 6303 (BCP
163) recommending locally service the two reverse zones, but neither
says what the zones are supposed to look like.  Although RFC 2606 says

      The ".localhost" TLD has traditionally been statically defined in
      host DNS implementations as having an A record pointing to the
      loop back IP address and is reserved for such use.  Any other use
      would conflict with widely deployed code which assumes this use.

I believe this does not exclude adding any other RR in addition to the A
record.  There obviously has to be a SOA and NS record there, even
though those are not mentioned.

RFC 6303 is even less explicit about the reverse zone contents:

   The recommendation to serve an empty zone 127.IN-ADDR.ARPA is not an
   attempt to discourage any practice to provide a PTR RR for
   1.0.0.127.IN-ADDR.ARPA locally.  In fact, a meaningful reverse
   mapping should exist, but the exact setup is out of the scope of this
   document.  Similar logic applies to the reverse mapping for ::1
   (Section 4.3).  The recommendations made here simply assume that no
   other coverage for these domains exists.


So what is the best current practice?  Should "localhost" have both an A
and AAAA record?


Bjørn



More information about the ipv6-ops mailing list