author | Tero Marttila <terom@paivola.fi> |
Tue, 10 Mar 2015 00:30:31 +0200 | |
changeset 741 | 569d13a07ff5 |
parent 728 | d3cea9988848 |
permissions | -rw-r--r-- |
634 | 1 |
# pvl-hosts |
556 | 2 |
|
443 | 3 |
DNS/DHCP hosts management/integration for ISC bind9 and dhcpd. |
556 | 4 |
|
634 | 5 |
## Hosts |
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
6 |
The `pvl.hosts-*` tools read hosts files as input, which have an ini format, using section names as hostnames to configure attributes for that host: |
443 | 7 |
|
8 |
[foo] |
|
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
9 |
ip = 192.0.2.1 |
452
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
10 |
ethernet = 00:11:22:33:44:55 |
443 | 11 |
|
12 |
[bar] |
|
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
13 |
ip = 192.0.2.2 |
452
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
14 |
ethernet = 01:23:45:67:89:ab |
443 | 15 |
|
520
0310e199435a
README: fixup --zone-prefix=
Tero Marttila <tero.marttila@aalto.fi>
parents:
516
diff
changeset
|
16 |
The domain name for a host is determined from the basename of the config file, so this example file would generate something like the following output for use in a `zone "example.com" { ... }` zonefile: |
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
17 |
|
516
9615ffc647a0
pvl.hosts-forward: if only a single hosts file/dir is given, use it as the --zone-origin; support --root-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
514
diff
changeset
|
18 |
$ bin/pvl.hosts-forward etc/hosts/example.com |
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
19 |
foo A 192.0.2.1 |
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
20 |
bar A 192.0.2.2 |
443 | 21 |
|
520
0310e199435a
README: fixup --zone-prefix=
Tero Marttila <tero.marttila@aalto.fi>
parents:
516
diff
changeset
|
22 |
And correspondingly, the reverse zone for `2.0.192.in-addr.arpa`: |
443 | 23 |
|
520
0310e199435a
README: fixup --zone-prefix=
Tero Marttila <tero.marttila@aalto.fi>
parents:
516
diff
changeset
|
24 |
$ bin/pvl.hosts-reverse --zone-prefix=192.0.2.0/24 etc/hosts/example.com |
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
25 |
1 PTR foo.example.com. |
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
26 |
2 PTR bar.example.com. |
443 | 27 |
|
452
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
28 |
And the associated DHCP hosts: |
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
29 |
|
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
30 |
$ bin/pvl.hosts-dhcp etc/hosts/example.com |
452
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
31 |
host foo { |
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
32 |
option host-name foo; |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
33 |
hardware ethernet 00:11:22:33:44:55; |
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
34 |
fixed-address 192.0.2.1; |
452
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
35 |
} |
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
36 |
|
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
37 |
host bar { |
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
38 |
option host-name bar; |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
39 |
hardware ethernet 01:23:45:67:89:ab; |
512
dafac309813e
README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents:
509
diff
changeset
|
40 |
fixed-address 192.0.2.2; |
452
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
41 |
} |
d10f2b2188bb
README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents:
448
diff
changeset
|
42 |
|
634 | 43 |
### Include directories |
507
e3a32f4dff54
pvl.hosts.config: document includes, fix include-only zone, and test
Tero Marttila <tero.marttila@aalto.fi>
parents:
484
diff
changeset
|
44 |
Host configs can be included: |
e3a32f4dff54
pvl.hosts.config: document includes, fix include-only zone, and test
Tero Marttila <tero.marttila@aalto.fi>
parents:
484
diff
changeset
|
45 |
|
521
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
46 |
$ cat etc/hosts/test |
514
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
47 |
include = test.d/ |
507
e3a32f4dff54
pvl.hosts.config: document includes, fix include-only zone, and test
Tero Marttila <tero.marttila@aalto.fi>
parents:
484
diff
changeset
|
48 |
|
521
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
49 |
$ cat etc/hosts/test.d/foo |
507
e3a32f4dff54
pvl.hosts.config: document includes, fix include-only zone, and test
Tero Marttila <tero.marttila@aalto.fi>
parents:
484
diff
changeset
|
50 |
ip = 192.0.2.1 |
e3a32f4dff54
pvl.hosts.config: document includes, fix include-only zone, and test
Tero Marttila <tero.marttila@aalto.fi>
parents:
484
diff
changeset
|
51 |
|
521
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
52 |
$ cat etc/hosts/test.d/bar |
507
e3a32f4dff54
pvl.hosts.config: document includes, fix include-only zone, and test
Tero Marttila <tero.marttila@aalto.fi>
parents:
484
diff
changeset
|
53 |
ip = 192.0.2.2 |
e3a32f4dff54
pvl.hosts.config: document includes, fix include-only zone, and test
Tero Marttila <tero.marttila@aalto.fi>
parents:
484
diff
changeset
|
54 |
|
521
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
55 |
$ bin/pvl.hosts-forward etc/hosts/test |
514
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
56 |
foo A 192.0.2.1 |
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
57 |
bar A 192.0.2.2 |
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
58 |
|
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
59 |
Including a directory of files is equivalent to substituiting each file as a named section at the level of the include = statement. Note that this means that included files are treated directly as host definitions, IOW, you should NOT include a section name in an included host file unless you want to declare an additional subdomain: |
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
60 |
|
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
61 |
$ cat etc/hosts/wrong.test |
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
62 |
include = wrong.d/ |
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
63 |
|
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
64 |
$ etc/hosts/wrong.d/host |
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
65 |
[host] |
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
66 |
ip = 192.0.2.6 |
f19d86b20f24
README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents:
512
diff
changeset
|
67 |
|
516
9615ffc647a0
pvl.hosts-forward: if only a single hosts file/dir is given, use it as the --zone-origin; support --root-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
514
diff
changeset
|
68 |
Using the --root-zone option to generate the full FQDN for the host: |
9615ffc647a0
pvl.hosts-forward: if only a single hosts file/dir is given, use it as the --zone-origin; support --root-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
514
diff
changeset
|
69 |
|
9615ffc647a0
pvl.hosts-forward: if only a single hosts file/dir is given, use it as the --zone-origin; support --root-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
514
diff
changeset
|
70 |
$ bin/pvl.hosts-forward --root-zone etc/hosts/wrong.test |
9615ffc647a0
pvl.hosts-forward: if only a single hosts file/dir is given, use it as the --zone-origin; support --root-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
514
diff
changeset
|
71 |
host.host.wrong.test A 192.0.2.6 |
507
e3a32f4dff54
pvl.hosts.config: document includes, fix include-only zone, and test
Tero Marttila <tero.marttila@aalto.fi>
parents:
484
diff
changeset
|
72 |
|
634 | 73 |
### Host aliases |
484
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
74 |
Hosts can specify DNS aliases: |
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
75 |
|
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
76 |
[foo] |
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
77 |
ip = 127.0.0.1 |
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
78 |
alias = test1 |
705 | 79 |
alias4 = test |
484
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
80 |
|
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
81 |
[bar] |
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
82 |
ip = 127.0.0.2 |
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
83 |
alias = test2 |
705 | 84 |
alias4 = test |
484
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
85 |
|
705 | 86 |
$ bin/pvl.hosts-forward etc/hosts/alias.test |
484
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
87 |
foo A 127.0.0.1 |
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
88 |
test1 CNAME foo |
705 | 89 |
test A 127.0.0.1 |
484
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
90 |
bar A 127.0.0.2 |
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
91 |
test2 CNAME bar |
705 | 92 |
test A 127.0.0.2 |
93 |
||
94 |
Normal CNAME aliases cannot overlap with other hosts, but the IPv4/IPv6-only `alias4`/`alias6` may overlap. |
|
484
099dee149e74
document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents:
483
diff
changeset
|
95 |
|
634 | 96 |
### Generated hosts |
447
6f0357759e9b
pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents:
443
diff
changeset
|
97 |
The hosts file format supports something similar to bind9's $GENERATE directive for hosts: |
6f0357759e9b
pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents:
443
diff
changeset
|
98 |
|
705 | 99 |
[dyn{1-8}] |
100 |
ip = 10.1.16.$ |
|
447
6f0357759e9b
pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents:
443
diff
changeset
|
101 |
|
705 | 102 |
$ bin/pvl.hosts-forward etc/hosts/dyn.test |
103 |
dyn1 A 10.1.16.1 |
|
104 |
dyn2 A 10.1.16.2 |
|
105 |
dyn3 A 10.1.16.3 |
|
106 |
dyn4 A 10.1.16.4 |
|
107 |
dyn5 A 10.1.16.5 |
|
108 |
dyn6 A 10.1.16.6 |
|
109 |
dyn7 A 10.1.16.7 |
|
110 |
dyn8 A 10.1.16.8 |
|
111 |
||
448
5ab0ec8200c3
README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents:
447
diff
changeset
|
112 |
This feature can be used for generating reverse delegations: |
5ab0ec8200c3
README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents:
447
diff
changeset
|
113 |
[foo-{240-247}] |
5ab0ec8200c3
README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents:
447
diff
changeset
|
114 |
forward = |
5ab0ec8200c3
README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents:
447
diff
changeset
|
115 |
reverse = $.240/29.0.0.10.in-addr.arpa |
5ab0ec8200c3
README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents:
447
diff
changeset
|
116 |
ip = 10.0.0.$ |
705 | 117 |
|
118 |
$ bin/pvl.hosts-reverse --zone-prefix=10.0.0.0/16 etc/hosts/reverse.test |
|
119 |
240.0 CNAME 240.240/29.0.0.10.in-addr.arpa. |
|
120 |
241.0 CNAME 241.240/29.0.0.10.in-addr.arpa. |
|
121 |
242.0 CNAME 242.240/29.0.0.10.in-addr.arpa. |
|
122 |
243.0 CNAME 243.240/29.0.0.10.in-addr.arpa. |
|
123 |
244.0 CNAME 244.240/29.0.0.10.in-addr.arpa. |
|
124 |
245.0 CNAME 245.240/29.0.0.10.in-addr.arpa. |
|
125 |
246.0 CNAME 246.240/29.0.0.10.in-addr.arpa. |
|
126 |
247.0 CNAME 247.240/29.0.0.10.in-addr.arpa. |
|
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
127 |
|
634 | 128 |
### DHCP Options |
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
129 |
The hosts need not specify any fixed ip address, leaving IP address allocation to dhcpd: |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
130 |
|
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
131 |
[foo] |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
132 |
ethernet = 00:11:22:33:44:55 |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
133 |
|
705 | 134 |
$ bin/pvl.hosts-dhcp etc/hosts/dhcp.test |
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
135 |
host foo { |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
136 |
option host-name foo; |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
137 |
hardware ethernet 00:11:22:33:44:55; |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
138 |
} |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
139 |
|
634 | 140 |
### DHCP Boot options |
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
141 |
The hosts can specify DHCP boot server/file options: |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
142 |
|
705 | 143 |
boot.next-server = boot.test |
144 |
||
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
145 |
[foo] |
705 | 146 |
ethernet = 00:11:22:33:44:55 |
147 |
boot = boot2.test:/debian/wheezy/pxelinux.0 |
|
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
148 |
|
705 | 149 |
[bar] |
150 |
ethernet = 00:11:22:33:44:55 |
|
151 |
boot.filename = /debian/jessie/pxelinux.0 |
|
152 |
||
153 |
$ bin/pvl.hosts-dhcp etc/hosts/boot.test |
|
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
154 |
host foo { |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
155 |
option host-name foo; |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
156 |
hardware ethernet 00:11:22:33:44:55; |
705 | 157 |
next-server boot2.test; |
158 |
filename "/debian/wheezy/pxelinux.0"; |
|
159 |
} |
|
160 |
||
161 |
host bar { |
|
162 |
option host-name bar; |
|
163 |
hardware ethernet 00:11:22:33:44:55; |
|
164 |
next-server boot.test; |
|
165 |
filename "/debian/jessie/pxelinux.0"; |
|
480
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
166 |
} |
7e44854e85d4
README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents:
452
diff
changeset
|
167 |
|
634 | 168 |
### DHCP hosts in multiple subnets/domains |
483
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
169 |
A host with different interfaces in multiple domains must specify unique interface names: |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
170 |
|
705 | 171 |
[foo] |
483
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
172 |
[[asdf]] |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
173 |
ip = 10.1.0.1 |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
174 |
ethernet.eth1 = 00:11:22:33:44:55 |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
175 |
|
705 | 176 |
[bar] |
483
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
177 |
[[asdf]] |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
178 |
ip = 10.2.0.1 |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
179 |
ethernet.eth2 = 55:44:33:22:11:00 |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
180 |
|
705 | 181 |
$ bin/pvl.hosts-dhcp etc/hosts/dhcp-test |
483
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
182 |
host asdf-eth1 { |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
183 |
option host-name asdf; |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
184 |
hardware ethernet 00:11:22:33:44:55; |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
185 |
fixed-address 10.1.0.1; |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
186 |
} |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
187 |
|
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
188 |
host asdf-eth2 { |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
189 |
option host-name asdf; |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
190 |
hardware ethernet 55:44:33:22:11:00; |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
191 |
fixed-address 10.2.0.1; |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
192 |
} |
19d084bb4afd
pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents:
480
diff
changeset
|
193 |
|
706 | 194 |
### DHCP subgroups |
195 |
Hosts can be assigned to DHCP subgroups by hardware ethernet: |
|
196 |
||
197 |
#### `dhcpd.conf` |
|
198 |
class "test-hosts" { |
|
199 |
match hardware; |
|
200 |
} |
|
201 |
||
202 |
#### `etc/hosts/dhcp-classes.test` |
|
203 |
[foo] |
|
204 |
ethernet = 00:11:22:33:44:55 |
|
205 |
dhcp:subclass = test-hosts |
|
206 |
||
207 |
#### `bin/pvl.hosts-dhcp etc/hosts/dhcp-classes.test` |
|
208 |
host foo { |
|
209 |
option host-name foo; |
|
210 |
hardware ethernet 00:11:22:33:44:55; |
|
211 |
} |
|
212 |
||
213 |
subclass "test-hosts" 1:00:11:22:33:44:55; |
|
214 |
||
634 | 215 |
# `update` |
626
5cd99761fe4d
merge in the pvl-dns repo, with all of its history
Tero Marttila <tero.marttila@aalto.fi>
diff
changeset
|
216 |
A script to drive the *pvl.hosts* tools for maintaing a set of zone/host files for a DNS/DHCP server. |
5cd99761fe4d
merge in the pvl-dns repo, with all of its history
Tero Marttila <tero.marttila@aalto.fi>
diff
changeset
|
217 |
|
634 | 218 |
## Source host files |
521
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
219 |
|
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
220 |
Creating a tree of symlinks for managing split zonefile domains can be useful: |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
221 |
|
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
222 |
$ tree etc/zones/ |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
223 |
etc/zones/ |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
224 |
├── forward |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
225 |
│  └── test |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
226 |
│  ├── asdf.test -> ../../../hosts/asdf.test |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
227 |
│  └── test -> ../../../hosts/test |
705 | 228 |
├── reverse |
229 |
│  └── 192.0.2 |
|
230 |
│  ├── asdf.test -> ../../../hosts/asdf.test |
|
231 |
│  └── test -> ../../../hosts/test |
|
232 |
└── test |
|
521
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
233 |
|
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
234 |
Given a structure like above, the `pvl.hosts-forward` can generate a single forward zone containing all sub-domains: |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
235 |
|
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
236 |
$ bin/pvl.hosts-forward --hosts-include etc/hosts/ etc/zones/forward/test/ |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
237 |
foo A 192.0.2.1 |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
238 |
bar A 192.0.2.2 |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
239 |
quux.asdf A 192.0.2.5 |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
240 |
|
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
241 |
Note that the directory name is treated separately as a zone origin; the file names within the domain are still treated as a flat namespace independent of the directory name (which is different than *pvl.hosts* would behave for `include = etc/zones/forward/test/`). |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
242 |
|
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
243 |
The same trick also works for `pvl.hosts-reverse`: |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
244 |
|
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
245 |
$ bin/pvl.hosts-reverse --hosts-include etc/hosts/ etc/zones/reverse/192.0.2/ |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
246 |
1 PTR foo.test. |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
247 |
2 PTR bar.test. |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
248 |
5 PTR quux.asdf.test. |
06792c78067e
setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents:
520
diff
changeset
|
249 |
|
645 | 250 |
## Source zone files |
251 |
||
252 |
The zonefile header should be written out manually, using an `$INCLUDE` directive to reference the (generated) hosts zonefile: |
|
253 |
||
254 |
$ cat etc/zones/test |
|
255 |
$TTL 3600 |
|
256 |
||
257 |
@ SOA foo.test. hostmaster.test. ( |
|
258 |
0 ; serial |
|
259 |
1d ; refresh |
|
260 |
5m ; retry |
|
261 |
10d ; expiry |
|
262 |
300 ; negative |
|
263 |
) |
|
264 |
||
265 |
NS foo |
|
266 |
NS bar |
|
267 |
||
268 |
$INCLUDE "forward/test" |
|
269 |
||
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
270 |
## Operation |
557 | 271 |
|
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
272 |
Use the *update* script to generate a complete set of output zonefiles: |
557 | 273 |
|
724
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
274 |
$ ./bin/update -C |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
275 |
var: apply dir |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
276 |
var/dhcp: apply dir |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
277 |
var/zones: apply dir |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
278 |
var/include-cache: apply dir |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
279 |
var/serials: apply dir |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
280 |
var/dhcp/hosts: apply dir |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
281 |
var/zones/includes: apply dir |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
282 |
var/zones/forward: apply dir |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
283 |
var/zones/reverse: apply dir |
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
284 |
Commit... |
724
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
285 |
Using commit timestamp: 1425379711 |
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
286 |
Updating forward host zones... |
705 | 287 |
var/zones/forward/test: Generating forward hosts zone: etc/zones/forward/test |
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
288 |
Updating reverse host zones... |
705 | 289 |
var/zones/reverse/192.0.2: Generating reverse hosts zone: etc/zones/reverse/192.0.2 |
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
290 |
Updating DHCP hosts... |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
291 |
Copying zone includes... |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
292 |
Updating zones... |
724
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
293 |
var/serials/test: Update serial: <- 1425379711 |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
294 |
var/zones/test: Generate zone: etc/zones/test @ 1425379711 |
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
295 |
Updating DHCP confs... |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
296 |
Testing zones... |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
297 |
Reload zones... |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
298 |
Reload zones |
724
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
299 |
* Reloading domain name service... bind9 [ OK ] |
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
300 |
Testing DHCP... |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
301 |
Reload DHCP... |
724
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
302 |
Reload DHCP |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
303 |
isc-dhcp-server stop/waiting |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
304 |
isc-dhcp-server start/running, process 32581 |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
305 |
|
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
306 |
The update script tracks hostfile/zonefile dependencies, and only updates the necessary output files: |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
307 |
|
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
308 |
$ touch etc/hosts/test.d/foo && ./bin/update -C |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
309 |
Commit... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
310 |
Using commit timestamp: 1425379801 |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
311 |
Updating forward host zones... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
312 |
var/zones/forward/test: Generating forward hosts zone: etc/zones/forward/test |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
313 |
Updating reverse host zones... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
314 |
var/zones/reverse/192.0.2: Generating reverse hosts zone: etc/zones/reverse/192.0.2 |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
315 |
Updating DHCP hosts... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
316 |
Copying zone includes... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
317 |
Updating zones... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
318 |
var/serials/test: Update serial: 1425379801 <- 1425379801 |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
319 |
var/zones/test: Generate zone: etc/zones/test @ 1425379801 |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
320 |
Updating DHCP confs... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
321 |
Testing zones... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
322 |
Reload zones... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
323 |
Reload zones |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
324 |
* Reloading domain name service... bind9 ...done. |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
325 |
Testing DHCP... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
326 |
Reload DHCP... |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
327 |
Reload DHCP |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
328 |
isc-dhcp-server stop/waiting |
68abad09d54b
README: ./update examples
Tero Marttila <tero.marttila@aalto.fi>
parents:
646
diff
changeset
|
329 |
isc-dhcp-server start/running, process 775 |
557 | 330 |
|
726
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
331 |
Use `-n` to enable noop mode and preview changes before updating: |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
332 |
|
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
333 |
sed -i s/quux/quux2/ etc/hosts/asdf.test && ./bin/update -C -n |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
334 |
Commit... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
335 |
/home/tjmartti/pvl/pvl-hosts: skip commit |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
336 |
Using local unix time for uncommited changes: 1425380558 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
337 |
Updating forward host zones... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
338 |
var/zones/forward/test: Generating forward hosts zone: etc/zones/forward/test |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
339 |
--- var/zones/forward/test 2015-03-03 12:55:53.480735624 +0200 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
340 |
+++ var/zones/forward/test.new 2015-03-03 13:02:38.708732551 +0200 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
341 |
@@ -2,2 +2,2 @@ |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
342 |
bar A 192.0.2.2 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
343 |
-quux.asdf A 192.0.2.5 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
344 |
+quux22.asdf A 192.0.2.5 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
345 |
Updating reverse host zones... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
346 |
var/zones/reverse/192.0.2: Generating reverse hosts zone: etc/zones/reverse/192.0.2 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
347 |
--- var/zones/reverse/192.0.2 2015-03-03 12:55:53.596735623 +0200 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
348 |
+++ var/zones/reverse/192.0.2.new 2015-03-03 13:02:38.832732550 +0200 |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
349 |
@@ -2,2 +2,2 @@ |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
350 |
2 PTR bar.test. |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
351 |
-5 PTR quux.asdf.test. |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
352 |
+5 PTR quux22.asdf.test. |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
353 |
Updating DHCP hosts... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
354 |
Copying zone includes... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
355 |
Updating zones... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
356 |
Updating DHCP confs... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
357 |
Testing zones... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
358 |
Reload zones... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
359 |
Skip reload zones |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
360 |
Testing DHCP... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
361 |
Reload DHCP... |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
362 |
Skip reload DHCP |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
363 |
|
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
364 |
Note that noop mode does not yet handle dependency chains, i.e. you will not see which zones get updated serials without also using `-F`, which force-updates all output files regardless of dependency states. |
8790e1e28661
README: example of update -n
Tero Marttila <tero.marttila@aalto.fi>
parents:
724
diff
changeset
|
365 |
|
727
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
366 |
Finally, the default operation mode of update is to commit any changes, and update the zones using the commit timestamp as a serial. Use the `-p` flag to show output diffs as with `-n`: |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
367 |
|
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
368 |
$ sed -i s/quux/quux2/ etc/hosts/asdf.test && ./bin/update -m "rename quux to quux2" -p |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
369 |
Commit... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
370 |
/home/tjmartti/pvl/pvl-hosts: commit: rename quux to quux2 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
371 |
diff -r 8790e1e28661 etc/hosts/asdf.test |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
372 |
--- a/etc/hosts/asdf.test Tue Mar 03 13:05:13 2015 +0200 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
373 |
+++ b/etc/hosts/asdf.test Tue Mar 03 13:06:03 2015 +0200 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
374 |
@@ -1,2 +1,2 @@ |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
375 |
-[quux] |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
376 |
+[quux2] |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
377 |
ip = 192.0.2.5 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
378 |
Using commit timestamp: 1425380763 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
379 |
Updating forward host zones... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
380 |
var/zones/forward/test: Generating forward hosts zone: etc/zones/forward/test |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
381 |
--- var/zones/forward/test 2015-03-03 13:04:09.556731909 +0200 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
382 |
+++ var/zones/forward/test.new 2015-03-03 13:06:04.260731122 +0200 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
383 |
@@ -2,2 +2,2 @@ |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
384 |
bar A 192.0.2.2 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
385 |
-quux22.asdf A 192.0.2.5 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
386 |
+quux2.asdf A 192.0.2.5 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
387 |
Updating reverse host zones... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
388 |
var/zones/reverse/192.0.2: Generating reverse hosts zone: etc/zones/reverse/192.0.2 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
389 |
--- var/zones/reverse/192.0.2 2015-03-03 13:04:09.684731908 +0200 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
390 |
+++ var/zones/reverse/192.0.2.new 2015-03-03 13:06:04.384731122 +0200 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
391 |
@@ -2,2 +2,2 @@ |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
392 |
2 PTR bar.test. |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
393 |
-5 PTR quux22.asdf.test. |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
394 |
+5 PTR quux2.asdf.test. |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
395 |
Updating DHCP hosts... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
396 |
Copying zone includes... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
397 |
Updating zones... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
398 |
var/serials/test: Update serial: 1425380649 <- 1425380763 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
399 |
var/zones/test: Generate zone: etc/zones/test @ 1425380763 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
400 |
--- var/zones/test 2015-03-03 13:04:09.812731907 +0200 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
401 |
+++ var/zones/test.new 2015-03-03 13:06:04.512731121 +0200 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
402 |
@@ -1,3 +1,3 @@ |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
403 |
$TTL 3600 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
404 |
-@ SOA foo.test. hostmaster.test. 1425380649 1d 5m 10d 300 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
405 |
+@ SOA foo.test. hostmaster.test. 1425380763 1d 5m 10d 300 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
406 |
NS foo |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
407 |
Updating DHCP confs... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
408 |
Testing zones... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
409 |
Reload zones... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
410 |
Reload zones |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
411 |
* Reloading domain name service... bind9 [ OK ] |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
412 |
Testing DHCP... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
413 |
Reload DHCP... |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
414 |
Reload DHCP |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
415 |
isc-dhcp-server stop/waiting |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
416 |
isc-dhcp-server start/running, process 2839 |
956fdb057cf0
README: document update-with-commit
Tero Marttila <tero.marttila@aalto.fi>
parents:
726
diff
changeset
|
417 |
|
557 | 418 |
|
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
419 |
## Output zone files |
557 | 420 |
|
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
421 |
The generated zone files can then be loaded by bind: |
556 | 422 |
|
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
423 |
$ cat var/zones/test |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
424 |
$TTL 3600 |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
425 |
@ SOA foo.test. hostmaster.test. 1425049508 1d 5m 10d 300 |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
426 |
NS foo |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
427 |
NS bar |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
428 |
$INCLUDE "./var/zones/forward/test" |
579 | 429 |
|
646
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
430 |
$ cat var/zones/forward/test |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
431 |
foo A 192.0.2.1 |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
432 |
bar A 192.0.2.2 |
585fe8171ac6
README: better ./update docs
Tero Marttila <tero.marttila@aalto.fi>
parents:
645
diff
changeset
|
433 |
quux.asdf A 192.0.2.5 |
601 | 434 |
|
644
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
435 |
# *pvl-dns* |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
436 |
Low-level zonefile utilities. |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
437 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
438 |
## `bin/pvl.dns-process` |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
439 |
Process a zonefile to modify: |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
440 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
441 |
* `SOA` record serial |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
442 |
* `$INCLUDE` paths |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
443 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
444 |
$ bin/pvl.dns-process --serial $(date +%s) --include-path var/zones etc/zones/test |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
445 |
$TTL 3600 |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
446 |
@ SOA foo.test. hostmaster.test. 1425049088 1d 5m 10d 300 |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
447 |
NS foo |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
448 |
NS bar |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
449 |
$INCLUDE "var/zones/forward/test" |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
450 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
451 |
## `bin/pvl.dns-zone` |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
452 |
Load a zonefile and output any ZoneRecords that it contains, including `$GENERATE`ed and `$INCLUDE`ed records: |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
453 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
454 |
$ bin/pvl.dns-zone --zone=test var/zones/test |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
455 |
@ 3600 SOA foo.test. hostmaster.test. 1425049248 1d 5m 10d 300 |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
456 |
@ 3600 NS foo |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
457 |
@ 3600 NS bar |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
458 |
foo 3600 A 192.0.2.1 |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
459 |
bar 3600 A 192.0.2.2 |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
460 |
quux.asdf 3600 A 192.0.2.5 |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
461 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
462 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
463 |
Optionally `--check-hosts` for dupliates `A`/`AAAA` records. |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
464 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
465 |
Use `--reverse-prefix=192.0.2` to generate a reverse-dns zone from `A`/`AAAA` records: |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
466 |
|
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
467 |
$ bin/pvl.dns-zone --zone=test var/zones/test --reverse-prefix=192.0.2 |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
468 |
1 PTR foo.test. |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
469 |
2 PTR bar.test. |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
470 |
5 PTR quux.asdf.test. |
c51eb0151fec
README pvl.dns-process and pvl.dns-zone
Tero Marttila <tero.marttila@aalto.fi>
parents:
634
diff
changeset
|
471 |
|
634 | 472 |
# Experimental features |
601 | 473 |
|
522
6bc714379a13
README: experimental features
Tero Marttila <tero.marttila@aalto.fi>
parents:
521
diff
changeset
|
474 |
Features that are still under development |
601 | 475 |
|
522
6bc714379a13
README: experimental features
Tero Marttila <tero.marttila@aalto.fi>
parents:
521
diff
changeset
|
476 |
* DHCP host status tracking from syslog/dhcpd.leases into a database |
6bc714379a13
README: experimental features
Tero Marttila <tero.marttila@aalto.fi>
parents:
521
diff
changeset
|
477 |
* SNMP network topology discovery |