
gen6dns -- A command to manage DNS names for IPv6 hosts
=======================================================

(c) H. Zuleger HZNET

gen6dns is a tool to generate static DNS records (AAAA and PTR) for
hosts using Stateless Address Autoconfig (SLAAC).  If you have a list
of hostnames, mac addresses and ipv6 subnets gen6dns generates the
appropriate AAAA and PTR records for you. 

It supports different scopes and the generation of view (split)
specific files.

$ cat subnet.txt
#
#	A file to define Subnet names and IDs
#
%%SUBNET SECTION
#name	subnetid
srv	:a0b1:
clt	:a0b2:
dmz	:0001:
lo	:0:
mgmtlo	:f000:

$ cat scope.txt
#
#	A file for scope definitions (domain names, views and matching prefixes)
#
%%SCOPE SECTION
#name		view	domain			matchprefix
prov1		*	example.de.		2003::/19	# telekom
prov2		*	example.de.		2a00::/22	# vodafone (arcor)
allpub		none	example.de.		2000::/3	# match on any public prefix
mgmt		intern	mgmt.example.de.	fd00::/8

$ cat hosts.txt
#
#	A file with host names, IID (mac address or interface identifier) and related subnet id
#
%% HOST SECTION
#name		int_id / mac_address	subnet_id	scope

horst		00:17:53:85:80:3b	clt		[prov1, prov2]
ns1		::53			srv		[prov1]
ns2		::d9b2:56f3:7694:1c5c	srv		[prov2]
hugo <24h>	00:13:35:a2:91:f4	:1:		[prov1, prov2, mgmt]
gustav.test	0013.35a2.91f5		:1:		[mgmt]
rtr1		::100b:0:0:1		lo		[mgmt]
With these input files forward and reverse dns record sets can be generated and stored in a couple of output files:
$ gen6dns -w -S -p 2003:db8:A::/48 -p 2a00:b8:B::/48 -p fda9:60e9:b504::/48 subnet.txt scope.txt hosts.txt 
$ ls g6*
g6d.example.de.
g6d_intern.mgmt.example.de.
g6r.0
g6r_intern.0

$ for f in  g6*; do echo "# $f"; cat $f; echo; done
# g6d.example.de.
horst                		IN  AAAA	2003:db8:a:a0b2:217:53ff:fe85:803b 
horst                		IN  AAAA	2a00:b8:b:a0b2:217:53ff:fe85:803b 
ns1                  		IN  AAAA	2003:db8:a:a0b1::53 
ns2                  		IN  AAAA	2a00:b8:b:a0b1:d9b2:56f3:7694:1c5c 
hugo                 	  86400	IN  AAAA	2003:db8:a:1:213:35ff:fea2:91f4 
hugo                 	  86400	IN  AAAA	2a00:b8:b:1:213:35ff:fea2:91f4 

# g6d_intern.mgmt.example.de.
hugo                 	  86400	IN  AAAA	fda9:60e9:b504:1:213:35ff:fea2:91f4 
gustav.test          		IN  AAAA	fda9:60e9:b504:1:213:35ff:fea2:91f5 
rtr1                 		IN  AAAA	fda9:60e9:b504:0:100b::1 

# g6r.0
b.3.0.8.5.8.e.f.f.f.3.5.7.1.2.0.2.b.0.a          IN  PTR	horst.example.de. 
3.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.b.0.a          IN  PTR	ns1.example.de. 
c.5.c.1.4.9.6.7.3.f.6.5.2.b.9.d.1.b.0.a          IN  PTR	ns2.example.de. 
4.f.1.9.2.a.e.f.f.f.5.3.3.1.2.0.1.0.0.0    86400 IN  PTR	hugo.example.de. 

# g6r_intern.0
4.f.1.9.2.a.e.f.f.f.5.3.3.1.2.0.1.0.0.0    86400 IN  PTR	hugo.mgmt.example.de. 
5.f.1.9.2.a.e.f.f.f.5.3.3.1.2.0.1.0.0.0          IN  PTR	gustav.test.mgmt.example.de. 
1.0.0.0.0.0.0.0.0.0.0.0.b.0.0.1.0.0.0.0          IN  PTR	rtr1.mgmt.example.de. 
The generated filenames have a prefix of "g6d" for forward (AAAA), and "g6r" for reverse (PTR) RR.
There are some other options and mode of operations:

$ gen6dns -h
usage: gen6dns -h|-V
usage: gen6dns -R [-b mask] 
usage: gen6dns [-f] [-s|-S] [-w|-a] [-t ttl] [-D] [-C] {-p|-6 prefix} [file ...]
usage: gen6dns [-r] [-b mask] [-w|-a] [-t ttl] [-D] [-C] [-o origin] {-p|-6 prefix} [file ...]
	-h, --help		 print out this help message 
	-V, --version		 print out version and exit 
	-R, --revzone		 print the ip6.arpa zone to the given prefix
	-v, --verbose		 give some hints about what's going on in the background 
				 use -v more than once increases the verbosity (up to level 2)
	-D, --delim[=char]	 use  additionally to white space as delimiter (default is ';')
	-C, --comment[=char]	 use  as comment character (default is '#')
	-s, --squeeze		 print ipv6 addresses w/o leading zeros (like 2001:db8:0:0:0:0:0:1/128)
	-S, --full-squeeze	 compress ipv6 address slightly more (like 2001:db8::1/128)
	-t, --ttl 	 specify ttl of RR (default is none or the host specific one)
				 known ttl units are s(ecs), m(ins), h(ours), d(ays) or w(eeks) 
	-f, --forward		 generate AAAA records for forward zone only 
	-r, --reverse		 generate PTR records for reverse zone only
				 The default is to generate forward and reverse zone entries
				 (The use of the -w switch is highly recommended then)
	-b, --bits[=mask]	 split zone files on  boundary (mask defaults to 48)
	-w, --write		 write output to files instead of stdout
				 filename is g6d. for the forward or g6r.0000 for the reverse zone
				 This option potentially generates a lot of files (up to the compiled in # of 128)
	-a, --append		 same as -w but append to the files instead of overwriting 
	-o, --origin=zone	 specify forward domain (default is example.net.)
	-p, --add-prefix=prefix	 network prefix to add (default is 2001:db8::/48)
	-6, --6to4=ipv4		 same as -p but argument is an ipv4 address
				 resulting prefix is a 6to4 prefix (2002:ipv4:addr::/48)
