Reverse DNS setup with IPv6

Well.. I suppose this section will interest lots of people ;p
remember, www.dnsspam.nl

Requirements

This doc is made for ISC BIND 8.x users (or some close version)
You can get bind at http://www.isc.org/products/BIND/
To run BIND you need some UNIX system (the NT port doesn't seem very efficient) including
Linux, xBSD, Solaris, Digital Unix, HP/UX, ...

Here's a link for BIND9 info: http://www.crt.se/dnssec/bind9/

How does reverse lookup work ?

First I'll explain with IPv4. Its quite the same, but looks simpler because less digits
My explanation isn't too clear for people who don't know about bind and DNS, so if you have something better, please contribute =)

in-addr.arpa is the v4 reverse top-level domain. Since it's reverse lookup, to keep all that hierarchical stuff ok, the order is also reversed
so a complete reverse entry for IP in the form a.b.c.d is d.c.b.a.in-addr.arpa. IN PTR host.domain.tld.

a company who has eg. a /24 that's 27.42.4.0 -> 27.42.4.255 has 4.42.27.in-addr.arpa delegated
and then

$ORIGIN 4.42.27.in-addr.arpa.
1 IN PTR ns1.company.com.
2 IN PTR www1.company.com.
3 IN PTR mx1.company.com.
4 IN PTR mx2.company.com.
5 IN PTR news.company.com.
6 IN PTR station1.dev.company.com.

etc..

Now for IPv6

for the moment the top level domain for IPv6 is ip6.int.

addresses are in the form xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx (8 groups)
reverse scheme is x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.ip6.int. IN PTR host.domain.com.
(32 digits yeah, each are hex)

here's a real example
for 3ffe:80e8:d8::1
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.d.0.0.8.e.0.8.e.f.f.3.ip6.int IN PTR azuria.ipv6.delta6.net.

A complete example

ok lets imagine you have been delegated 3ffe:1200:1234:1234::/64
and you admin ns1.mydomain.com and ns2.mydomain.com

here's the conversion to reverse:

4.3.2.1.4.3.2.1.0.0.2.1.e.f.f.3.ip6.int

first checkout it has been delegated to you. for that:

% host -t ns 4.3.2.1.4.3.2.1.0.0.2.1.e.f.f.3.ip6.int
4.3.2.1.4.3.2.1.0.0.2.1.e.f.f.3.ip6.int IN PTR ns1.mydomain.com.
4.3.2.1.4.3.2.1.0.0.2.1.e.f.f.3.ip6.int IN PTR ns2.mydomain.com.

cool, it works. lets setup now

in named.conf

----------------------------------

zone "4.3.2.1.4.3.2.1.0.0.2.1.e.f.f.3.ip6.int"    {
   type master;
   file "db.ipv6.reverse1";
};

----------------------------------

and now the db.ipv6.reverse1 file (lets say your email is hostmaster@mydomain.com)

----------------------------------

$TTL 1D

$ORIGIN 4.3.2.1.4.3.2.1.0.0.2.1.e.f.f.3.ip6.int.    (
@	IN	SOA	ns1.mydomain.com.	hostmaster.mydomain.com. (
	2001052001 ; serial in the scheme YYYYMMDDNN, last modif of the file
	12H ; refresh
	900 ; retry
	2W ; expire
	1D ; default TTL
	)
	
	IN	NS	ns1.mydomain.com.
	IN	NS	ns2.mydomain.com.
	
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0	IN	PTR	host1.ipv6.mydomain.com.
; that's 3ffe:1200:1234:1234::1

a.0.0.0.0.0.0.0.0.0.0.0.0.0.b.0	IN	PTR	superhost.ipv6.mydomain.com.
; that's 3ffe:1200:1234:1234:b00::a

----------------------------------

Last little tip. a nice ipv6 -> reverse utility, written in perl

download ip6_int

here's the stuff it can do

% ip6_int 3ffe:80e8:d8::/48
8.d.0.0.8.e.0.8.e.f.f.3.ip6.int


% ip6_int 3ffe:80e8:d8::1
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.d.0.0.8.e.0.8.e.f.f.3.ip6.int


% host -t ptr 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.d.0.0.8.e.0.8.e.f.f.3.ip6.int
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.d.0.0.8.e.0.8.e.f.f.3.ip6.int domain    name pointer azuria.ipv6.delta6.net


% host -t ptr `ip6_int 3ffe:80e8:d8::1`
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.d.0.0.8.e.0.8.e.f.f.3.ip6.int domain    name pointer azuria.ipv6.delta6.net

;)