• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

doc/H03-May-2022-204146

examples/H03-May-2022-274167

test/H20-Oct-2017-11171

.gitignoreH A D20-Oct-2017229 2522

CHANGELOGH A D20-Oct-20171.3 KiB5531

LICENSEH A D20-Oct-20171.5 KiB3124

Makefile.inH A D20-Oct-20173.4 KiB12574

README.mdH A D20-Oct-20177.4 KiB196141

config.h.inH A D20-Oct-20172.8 KiB10772

configureH A D20-Oct-2017149 KiB5,3414,426

configure.acH A D20-Oct-20171.4 KiB6344

debug.hH A D20-Oct-20173.1 KiB6726

filep.cH A D20-Oct-20175.6 KiB254192

filep.hH A D20-Oct-2017958 3420

gen6dns.1H A D20-Oct-201712.8 KiB444411

gen6dns.cH A D20-Oct-201721.9 KiB732595

gen6dns.hH A D20-Oct-20171.5 KiB7967

hostid.cH A D20-Oct-20178.1 KiB390280

hostid.hH A D20-Oct-20171.3 KiB4334

hostptr.cH A D20-Oct-20173.7 KiB153107

hostptr.hH A D20-Oct-2017239 94

ip6.cH A D20-Oct-201718.5 KiB874614

ip6.hH A D20-Oct-20172.5 KiB6748

misc.cH A D20-Oct-20176.5 KiB277171

misc.hH A D20-Oct-20172.7 KiB7130

parse.cH A D20-Oct-20179.6 KiB397304

parse.hH A D20-Oct-2017319 126

scope.cH A D20-Oct-20179.1 KiB374263

scope.hH A D20-Oct-20171.1 KiB4434

soaserial.cH A D20-Oct-201713.8 KiB498299

squeezev6.cH A D20-Oct-20172.4 KiB11689

squeezev6.hH A D20-Oct-2017376 115

subnet.cH A D20-Oct-20172.9 KiB12782

subnet.hH A D20-Oct-2017497 2214

README.md

1
2gen6dns -- A command to manage DNS names for IPv6 hosts
3=======================================================
4
5(c) Feb 2015 - Nov 2015  H. Zuleger HZNET
6
7This version of gen6dns is based on a previous one which uses a
8different file format, so both versions are not compatible to each other.
9
10## Overview
11
12The command uses a text file as input "database". Each line represents
13a single interface of an host which should get a name in the domain name system.
14
15In it's simplest form, a line contains a dns name (label) for an IP interface.
16Because of the fact that most of the hosts are single homed, each line
17represents a host via its interface.
18
19The next column in the line is the MAC address of the interface written in
20the typical way, which means 6 times two hex digits separated by ":" or "-",
21or 3 times four hex digits separated by ".".
22In this case a 64 bit eui-64 interface identifier will be constructed out of
23the MAC address.
24If the column starts with two double colons ("::"), than these are the right
2564 bit of the IPv6 address, so it is the Interface IDentifier (IID) itself.
26
27The next column is the subnet identifier written as a four digit hex value enclosed
28in double colons.
29
30
31## Example
32
33Example (hosts.simple):
34
35	horst		00:17:53:85:80:3b	:c1:
36	gustav.test	0013.35a2.91f5		:2:
37	hugo <2h>	::d9b2:56f3:7694:1c5c	:c1:
38	rtr1		::a:1			:0:
39
40The name can be a domain name followed by an TTL value enclosed in "<>".
41
42The command
43
44	$ gen6dns -f -S -p 2001:db8:ab::/48  hosts.simple
45	horst                		IN  AAAA	2001:db8:ab:c1:217:53ff:fe85:803b
46	gustav.test          		IN  AAAA	2001:db8:ab:2:213:35ff:fea2:91f5
47	hugo                 	   7200	IN  AAAA	2001:db8:ab:c1:d9b2:56f3:7694:1c5c
48	rtr1                 		IN  AAAA	2001:db8:ab::a:1
49
50generates the forward dns entries for the given prefix.
51The output can be redirected into a file to include it for example in a BIND zone file.
52The option `-S` shortens the IPv6 address in the usual way.
53
54The corresponding reverse entries are generated with a second run.  Now the option
55`-o <domain>` is needed to define the target FQDN of the PTR record.
56
57	$ gen6dns -r -o example.net  -p 2001:db8:ab::/48  hosts.simple
58	b.3.0.8.5.8.e.f.f.f.3.5.7.1.2.0.1.c.0.0          IN  PTR	horst.example.net.
59	5.f.1.9.2.a.e.f.f.f.5.3.3.1.2.0.2.0.0.0          IN  PTR	gustav.test.example.net.
60	c.5.c.1.4.9.6.7.3.f.6.5.2.b.9.d.1.c.0.0     7200 IN  PTR	hugo.example.net.
61	1.0.0.0.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0          IN  PTR	rtr1.example.net.
62
63In this example the reverse entry is split at the /48 boundary, so all PTR records
64end up in one reverse zone.
65
66
67## Subnet name definition
68
69Instead of the subnet ID, a subnet name can be used if a mapping between subnet name
70and ID is done before.
71To start a subnet definition put the text `%%SUBNET SECTION` into a file, and
72then define all your subnets with lines containing a subnet name followed by a subnet ID
73given in the same way as in the host file.
74
75	%%SUBNET SECTION
76
77	#name	subnetid
78	clt	:c1:
79	srv	:2:
80	lo	:0:
81
82Lines starting with a hash (`#`) are comment lines.
83The comment char can be changed by using the option `-C '<char>'`.
84By the way: all columns are delimited by white space characters. If someone
85wants to change this, option `-D '<delimchar>'` can be used for.
86Reading the above subnet mapping in before the hosts file, the subnet name
87can be used instead of the subnet id itself:
88
89	horst		00:17:53:85:80:3b	clt
90	gustav.test	0013.35a2.91f5		srv
91	hugo <2h>	::d9b2:56f3:7694:1c5c	clt
92	rtr1		::a:1			lo
93
94
95## Writing into files
96
97Instead of printing the records to stdout, if gen6dns is run with option `-w` the
98dns records will be writen into files.
99The name of the file with the forward resource records is g6d.<domain>, while
100the name of the file with the reverse records is g6r.<subnetid>.
101If the option `-w`is used to write the output into files, the split of the
102reverse records can be done on any nibble boundary down to a /64.
103
104	$ gen6dns -w -b 64 -o example.net -S -p 2001:db8:ab::/48  subnet.txt hosts.txt
105
106Now four files are created:
107
108	$ ls g6*
109	g6d.example.net.
110	g6r.0000
111	g6r.0002
112	g6r.00c1
113
114One file for the AAAA records, and one file per subnet for the PTR records.
115
116
117## More than one prefix
118
119Option `-p <prefix>` defines the network prefix used to generate the full IPv6 address.
120IPv6 is well defined to work with multiple IPv6 addresses per interface.  In this case a
121DNS entry for a host has two or more AAAA records, one for each prefix.
122While from the protocol point of view not required, the use of the same subnet and
123interface ID for each prefix is highly recommended.
124
125To use more then one prefix, just add another -p option to the gen6dns run.
126The forward file will then contain one AAAA record per prefix.
127The reverse file can be used for all delegated prefix zones thanks to the use of
128the same subnetid.
129
130
131## Views or Subdomains
132
133DNS can use so called "views" to manage different answers depending on who is asking.
134In this case different zone files for the same zone are needed.
135This feature is mainly used to "hide" some of the hosts from outside dns resolution.
136
137To handle this, two zone files must be provided, and for each host the scope must be
138defined.
139
140Another way to achive this is to use different domains or subdomains for internal
141and external use.
142
143In general the use of subdomains should be preferred, because views have some problems
144with DNSSEC.
145However both mechanism are supported by `gen6dns` via scope definitions.
146
147A SCOPE SECTION is used to define a name, optional a name for a view, a domain name
148and a matching prefix:
149
150	%%SCOPE SECTION
151	#name		view	domain			matchprefix
152	pub		*	example.de.		2000::/3	# match on any public prefix
153	ula		intern	int.example.de.		fc00::/7	# match on ULA prefixes
154
155Both, the name of the view and the domain name is used to set up the output filename
156if option -w is used.
157The filename is `g6d_<viewname>.>domain>` for a forward zone and `g6r_<viename>.<subnetid>`
158for the reverse zone.
159
160To define which host gets which DNS record, each host entry can be extended by a scopelist
161enclosed in brackets.
162
163	# label		mac_address/IID		subnet_id
164	horst		00:17:53:85:80:3b	clt	[pub,ula]
165	gustav.test	0013.35a2.91f5		srv	[pub]
166	hugo <2h>	::d9b2:56f3:7694:1c5c	clt	[pub,ula]
167	rtr1		::a:1			lo	[ula]
168
169	$ gen6dns -w -p 2001:db8:ab::/48 -p fdb7:5796:cded::/48  scope.txt subnet.txt hosts.txt
170	$ ls g6*
171	g6d.example.de.
172	g6d_intern.int.example.de.
173	g6r.0
174	g6r_intern.0
175
176	$ cat g6d.example.de.
177	horst                	IN  AAAA	2001:0db8:00ab:00c1:0217:53ff:fe85:803b
178	gustav.test          	IN  AAAA	2001:0db8:00ab:0002:0213:35ff:fea2:91f5
179	hugo             7200	IN  AAAA	2001:0db8:00ab:00c1:d9b2:56f3:7694:1c5c
180
181	$ cat g6d_intern.int.example.de.
182	horst                	IN  AAAA	fdb7:5796:cded:00c1:0217:53ff:fe85:803b
183	hugo             7200	IN  AAAA	fdb7:5796:cded:00c1:d9b2:56f3:7694:1c5c
184	rtr1                 	IN  AAAA	fdb7:5796:cded:0000:0000:0000:000a:0001
185
186	$ cat g6r.0
187	b.3.0.8.5.8.e.f.f.f.3.5.7.1.2.0.1.c.0.0          IN  PTR	horst.example.de.
188	5.f.1.9.2.a.e.f.f.f.5.3.3.1.2.0.2.0.0.0          IN  PTR	gustav.test.example.de.
189	c.5.c.1.4.9.6.7.3.f.6.5.2.b.9.d.1.c.0.0     7200 IN  PTR	hugo.example.de.
190
191	$ cat g6r_intern.0
192	b.3.0.8.5.8.e.f.f.f.3.5.7.1.2.0.1.c.0.0          IN  PTR	horst.int.example.de.
193	c.5.c.1.4.9.6.7.3.f.6.5.2.b.9.d.1.c.0.0     7200 IN  PTR	hugo.int.example.de.
194	1.0.0.0.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0          IN  PTR	rtr1.int.example.de.
195
196