Steinar H. Gunderson

Sun, 24 Feb 2013 - IPv6 reverse generation

We recently renumbered (for the first, and I hope the last time), and in the process, the question of IPv6 adressing came up; how do you assign static IPv6 addresses within a given /64?

I won't be going into the full discussion of the various different strategies, but I'll say that one element of the solution chosen was that if you had an IPv4 address ending in .123, you'd also get an IPv6 address ending in ::123. (IPv6-only hostnames would be handled differently.)

But then, how do you make sure the reverses are in sync? For some reason, BIND doesn't have a good way of synthesizing a PTR name from an IPv6 address, so you're stuck with typing 3.2.1.0.0.0.0.0.0.etcetcetc and hope you got everything right. It's a pain.

So instead, behold:

$ORIGIN 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.f.9.2.c.7.6.0.1.0.0.2.ip6.arpa.

$GENERATE 1-9   $.0.0   CNAME   $.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.1.0   CNAME   1$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.2.0   CNAME   2$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.3.0   CNAME   3$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.4.0   CNAME   4$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.5.0   CNAME   5$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.6.0   CNAME   6$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.7.0   CNAME   7$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.8.0   CNAME   8$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.9.0   CNAME   9$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.0.1   CNAME   10$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.1.1   CNAME   11$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.2.1   CNAME   12$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.3.1   CNAME   13$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.4.1   CNAME   14$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.5.1   CNAME   15$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.6.1   CNAME   16$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.7.1   CNAME   17$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.8.1   CNAME   18$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.9.1   CNAME   19$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.0.2   CNAME   20$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.1.2   CNAME   21$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.2.2   CNAME   22$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.3.2   CNAME   23$.52.35.193.in-addr.arpa.
$GENERATE 0-9   $.4.2   CNAME   24$.52.35.193.in-addr.arpa.
$GENERATE 0-4   $.5.2   CNAME   25$.52.35.193.in-addr.arpa.

and voila:

pannekake:~> host 2001:67c:29f4::50
0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.f.9.2.c.7.6.0.1.0.0.2.ip6.arpa is an alias for 50.52.35.193.in-addr.arpa.
50.52.35.193.in-addr.arpa domain name pointer pannekake.samfundet.no.

Instant IPv4/IPv6 sync.

[14:17] | | IPv6 reverse generation

Steinar H. Gunderson <sgunderson@bigfoot.com>