BIND IPv6 reverse generator
Shadow Hawkins on Friday, 28 August 2009 12:54:47
Hi
during my IPv6 migration at University I developped a small script in ruby wich
generates AAAA and PTR records for BIND zones.
Can be usefull if used with a predefined range of address dispatched with DHCPv6.
You can find it here http://code.l0g.in/dns_gen/
Example
$ ./dns_gen.rb 2001:db8:dead::cafe 2001:db8:dead::cb01 mydomain.com dhcp
; HOSTS
dhcp-0-0-0-cafe4800 IN AAAA 2001:0db8:dead:0000:0000:0000:0000:cafe
dhcp-0-0-0-caff4800 IN AAAA 2001:0db8:dead:0000:0000:0000:0000:caff
dhcp-0-0-0-cb004800 IN AAAA 2001:0db8:dead:0000:0000:0000:0000:cb00
dhcp-0-0-0-cb014800 IN AAAA 2001:0db8:dead:0000:0000:0000:0000:cb01
; REVERSE
$ORIGIN 0.0.0.0.d.a.e.d.8.b.d.0.1.0.0.2.ip6.arpa.
e.f.a.c.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR dhcp-0-0-0-cafe.mydomain.com.
f.f.a.c.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR dhcp-0-0-0-caff.mydomain.com.
0.0.b.c.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR dhcp-0-0-0-cb00.mydomain.com.
1.0.b.c.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR dhcp-0-0-0-cb01.mydomain.com.
bye
BIND IPv6 reverse generator
Shadow Hawkins on Sunday, 07 March 2010 15:54:18
Online alternative to generate IPv6 Reverse Zones:
http://www.fpsn.net/index.cgi?pg=tools&tool=ipv6-inaddr
BIND IPv6 reverse generator
Shadow Hawkins on Thursday, 12 January 2012 00:20:33
I must ask if you really want to go down this road. The sizes of these tables, statically assigned, would be gigantic.
Are dynamically variants an option?
BIND IPv6 reverse generator
Jeroen Massar on Thursday, 12 January 2012 13:22:45
One can easily serve these kinds of zones with a mixture of PowerDNS and a custom backend which generates the records on the fly.
BIND IPv6 reverse generator
Carmen Sandiego on Thursday, 28 June 2012 23:54:23 Are dynamically variants an option?
I have recently been playing with dhcpv6 to assign IP's on my network at home rather than using stateless router advertisements and as part of this found out that you can use the $GENERATE directive with bind for IPv6 addressing. The documentation on it is a bit thin on the ground and there don't appear to be any examples found in google but I came up with this.
Forward zone:
$GENERATE 32-41 dhcp-${0,0,x} IN AAAA 2001:db8:1234:0::${0,0,x}
Reverse zone:
$GENERATE 32-41 ${0,31,n} PTR dhcp-${0,0,x}.example.com.
This generates addresses between 20 and 29 with the format dhcp-??.example.com and 2001:db8:1234:0::??. It's a little more complicated to do than the equivalent for IPv4 addressing as you are dealing with hexadecimal and nibbles. The 32-41 is decimal for 20-29 in hex. The 0,31,n means output 31 characters in nibble format and the 0,0,x means output in hex format. You could also change that to d for decimal. The 31 character nibble size is designed to populate a /48 sized zone file where I've just used the origin as "4.3.2.1.3.8.b.d.0.1.0.0.2.ip6.arpa". Obviously addresses have been altered to protect the innocent!
BIND IPv6 reverse generator
Jeroen Massar on Thursday, 28 June 2012 15:13:31
I've fixed the "innocent" addresses by using the IPv6 Documentation Prefix (2001:db8::/32) which is meant for that purpose.
BIND IPv6 reverse generator
Carmen Sandiego on Thursday, 28 June 2012 16:29:43
Thanks! But you missed one. The last line then should be 4.3.2.1.8.b.d.0.1.0.0.2.ip6.arpa I think if I've expanded the 0 in the right place.
BIND IPv6 reverse generator
Jeroen Massar on Thursday, 28 June 2012 23:53:52
Indeed, fixed too ;)
Posting is only allowed when you are logged in. |