Wednesday, 5 March 2014

How to configure reverse DNS for IPv6 range?

It is known, that this topic is a problem for many users, but in fact, configuring reverse DNS zone for IPv6 range is very simple. It is very similar to IPv4 reverse DNS zone and it is nothing more difficult, than editing a zone for the regular domain. The first thing, you should do, is to delegate reverse DNS zone of your IPv6 range to your name servers. As you know, you should have at least two name servers. Delegation is usually made by your provider. Than, you should add one line in /etc/bind/named.conf and create a file with your zone defined inside. This is everything. So let's do it.

/etc/bind/named.conf


Location of this file depends on the specific system, sometimes it may be /etc/named.conf or another file in /etc/bind directory. Anyway, it is a place, when links to all of the zones are placed. Let's imagine, that you have following IPv6 range:

2001:abcd:1234:ab12::/64

Now, you should convert this to the reverse DNS form:

2.1.b.a.4.3.2.1.d.c.b.a.1.0.0.2.ip6.arpa

As you can see, it is nothing more than your IP range written reversed with every digit separated by dot and ip6.arpa added at the end.

Than, you should define your new zone:

zone "2.1.b.a.4.3.2.1.d.c.b.a.1.0.0.2.ip6.arpa" {type master; file "2.1.b.a.4.3.2.1.d.c.b.a.1.0.0.2.ip6.arpa";};

/var/cache/bind/2.1.b.a.4.3.2.1.d.c.b.a.1.0.0.2.ip6.arpa


The last step is to configure this zone. Here you have an example:

$ORIGIN 2.1.b.a.4.3.2.1.d.c.b.a.1.0.0.2.ip6.arpa.
$TTL 86400
@ IN SOA dns.yourdomain.com. hostmaster.yourdomain.com. (1395848924 21605 7200 1209600 86400)
@ NS dns1.yourdomain.com.
@ NS dns2.yourdomain.com.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR ipv6.yourdomain.com.
2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR something.yourdomain.com.

Conclusion

I think, it is obvious now, that it is nothing difficult. At the end, restart your bind:

killall -HUP named

Remember to update serial after editing DNS zone in the future.