Tuesday, January 13, 2015

BIND 9.8 and ipv6 reverse records

The $GENERATE directive in a zone file includes nibble mode, which means you can do things like this

; reverse IPV6 zone file for example.com
$TTL 2d    ; default TTL for zone 172800 secs
@         IN      SOA   ns1.example.com. hostmaster.example.com. (
                        2003080800 ; sn = serial number
                        12h         ; refresh = refresh
                        15m        ; retry = update retry
                        3w         ; expiry = expiry
                        2h         ; min = minimum
; name servers Resource Recordsfor the domain
          IN      NS      ns1.example.com.
; the second name servers is 
; external to this zone (domain).
          IN      NS      ns2.example.net.
; PTR RR maps a IPv6 address to a host name
; hosts in subnet ID 1
$GENERATE 0-4294967295  ${0,15,n}. PTR 2001-0db8-0000-0001-0000-0000-${0,15,n}.example.com.

After adding the zone of course !

zone "" {
        type master;
        file "/etc/bind/ipv6.rev.local";


Jonathan Brown said...

The Generate line is incorrect. You did not account for the decimal character in the width section.

You have: $GENERATE 0-4294967295 ${0,15,n}. PTR 2001-0db8-0000-0001-0000-0000-${0,15,n}.example.com.

Here is the correct line.

$GENERATE 0-4294967295 ${0,23,n}. PTR 2001-0db8-0000-0001-0000-0000-${0,23,n}.example.com.

John Benavides said...

How to generate for 1220:2a80::/32