--- a/README.md Mon Mar 02 20:40:10 2015 +0200
+++ b/README.md Mon Mar 02 21:46:27 2015 +0200
@@ -76,56 +76,54 @@
[foo]
ip = 127.0.0.1
alias = test1
+ alias4 = test
[bar]
ip = 127.0.0.2
alias = test2
+ alias4 = test
- $ bin/pvl.hosts-forward --forward-zone alias.test etc/hosts/alias.test
+ $ bin/pvl.hosts-forward etc/hosts/alias.test
foo A 127.0.0.1
test1 CNAME foo
+ test A 127.0.0.1
bar A 127.0.0.2
test2 CNAME bar
+ test A 127.0.0.2
+
+Normal CNAME aliases cannot overlap with other hosts, but the IPv4/IPv6-only `alias4`/`alias6` may overlap.
### Generated hosts
The hosts file format supports something similar to bind9's $GENERATE directive for hosts:
- [asdf{1-3}]
- ip = 10.100.100.$
-
- $ bin/pvl.hosts-dns --forward-zone=asdf etc/hosts/asdf
- asdf1@asdf A 10.100.100.1
- asdf2@asdf A 10.100.100.2
- asdf3@asdf A 10.100.100.3
-
-Note that the generate directives are interpreted and compiled directly by pvl.hosts.
+ [dyn{1-8}]
+ ip = 10.1.16.$
-Most of the $GENERATE options should be supported, with a little clever hackery:
-
- [asdf{1-5/2}{0,2}]
- ip = 10.100.100.$${10}
-
- $ bin/pvl.hosts-dns --forward-zone=asdf2 etc/hosts/asdf2
- asdf01@asdf2 A 10.100.100.11
- asdf03@asdf2 A 10.100.100.13
- asdf05@asdf2 A 10.100.100.15
-
+ $ bin/pvl.hosts-forward etc/hosts/dyn.test
+ dyn1 A 10.1.16.1
+ dyn2 A 10.1.16.2
+ dyn3 A 10.1.16.3
+ dyn4 A 10.1.16.4
+ dyn5 A 10.1.16.5
+ dyn6 A 10.1.16.6
+ dyn7 A 10.1.16.7
+ dyn8 A 10.1.16.8
+
This feature can be used for generating reverse delegations:
-
[foo-{240-247}]
forward =
reverse = $.240/29.0.0.10.in-addr.arpa
ip = 10.0.0.$
-
- $ bin/pvl.hosts-dns --reverse-zone=10 etc/hosts/reverse
- 240.0.0 CNAME 240.240/29.0.0.10.in-addr.arpa.
- 241.0.0 CNAME 241.240/29.0.0.10.in-addr.arpa.
- 242.0.0 CNAME 242.240/29.0.0.10.in-addr.arpa.
- 243.0.0 CNAME 243.240/29.0.0.10.in-addr.arpa.
- 244.0.0 CNAME 244.240/29.0.0.10.in-addr.arpa.
- 245.0.0 CNAME 245.240/29.0.0.10.in-addr.arpa.
- 246.0.0 CNAME 246.240/29.0.0.10.in-addr.arpa.
- 247.0.0 CNAME 247.240/29.0.0.10.in-addr.arpa.
+
+ $ bin/pvl.hosts-reverse --zone-prefix=10.0.0.0/16 etc/hosts/reverse.test
+ 240.0 CNAME 240.240/29.0.0.10.in-addr.arpa.
+ 241.0 CNAME 241.240/29.0.0.10.in-addr.arpa.
+ 242.0 CNAME 242.240/29.0.0.10.in-addr.arpa.
+ 243.0 CNAME 243.240/29.0.0.10.in-addr.arpa.
+ 244.0 CNAME 244.240/29.0.0.10.in-addr.arpa.
+ 245.0 CNAME 245.240/29.0.0.10.in-addr.arpa.
+ 246.0 CNAME 246.240/29.0.0.10.in-addr.arpa.
+ 247.0 CNAME 247.240/29.0.0.10.in-addr.arpa.
### DHCP Options
The hosts need not specify any fixed ip address, leaving IP address allocation to dhcpd:
@@ -133,7 +131,7 @@
[foo]
ethernet = 00:11:22:33:44:55
- $ bin/pvl.hosts-dhcp etc/hosts/dhcp1
+ $ bin/pvl.hosts-dhcp etc/hosts/dhcp.test
host foo {
option host-name foo;
hardware ethernet 00:11:22:33:44:55;
@@ -142,32 +140,45 @@
### DHCP Boot options
The hosts can specify DHCP boot server/file options:
+ boot.next-server = boot.test
+
[foo]
- ethernet = 00:11:22:33:44:55
- boot = boot.lan:debian/wheezy/pxelinux.0
+ ethernet = 00:11:22:33:44:55
+ boot = boot2.test:/debian/wheezy/pxelinux.0
- $ bin/pvl.hosts-dhcp etc/hosts/boot.dhcp
+ [bar]
+ ethernet = 00:11:22:33:44:55
+ boot.filename = /debian/jessie/pxelinux.0
+
+ $ bin/pvl.hosts-dhcp etc/hosts/boot.test
host foo {
option host-name foo;
hardware ethernet 00:11:22:33:44:55;
- next-server boot.lan;
- filename debian/wheezy/pxelinux.0;
+ next-server boot2.test;
+ filename "/debian/wheezy/pxelinux.0";
+ }
+
+ host bar {
+ option host-name bar;
+ hardware ethernet 00:11:22:33:44:55;
+ next-server boot.test;
+ filename "/debian/jessie/pxelinux.0";
}
### DHCP hosts in multiple subnets/domains
A host with different interfaces in multiple domains must specify unique interface names:
- [foo.dhcp]
+ [foo]
[[asdf]]
ip = 10.1.0.1
ethernet.eth1 = 00:11:22:33:44:55
- [bar.dhcp]
+ [bar]
[[asdf]]
ip = 10.2.0.1
ethernet.eth2 = 55:44:33:22:11:00
- $ bin/pvl.hosts-dhcp etc/hosts/dhcp2
+ $ bin/pvl.hosts-dhcp etc/hosts/dhcp-test
host asdf-eth1 {
option host-name asdf;
hardware ethernet 00:11:22:33:44:55;
@@ -193,10 +204,11 @@
│ └── test
│ ├── asdf.test -> ../../../hosts/asdf.test
│ └── test -> ../../../hosts/test
- └── reverse
- └── 192.0.2
- ├── asdf.test -> ../../../hosts/asdf.test
- └── test -> ../../../hosts/test
+ ├── reverse
+ │ └── 192.0.2
+ │ ├── asdf.test -> ../../../hosts/asdf.test
+ │ └── test -> ../../../hosts/test
+ └── test
Given a structure like above, the `pvl.hosts-forward` can generate a single forward zone containing all sub-domains:
@@ -242,9 +254,9 @@
Commit...
Using commit timestamp: 1425049508
Updating forward host zones...
- var/zones/forward/test: Generating forward hosts zone: etc/zones/forward/test/
+ var/zones/forward/test: Generating forward hosts zone: etc/zones/forward/test
Updating reverse host zones...
- var/zones/reverse/192.0.2: Generating reverse hosts zone: etc/zones/reverse/192.0.2/
+ var/zones/reverse/192.0.2: Generating reverse hosts zone: etc/zones/reverse/192.0.2
Updating DHCP hosts...
Copying zone includes...
Updating zones...
--- a/etc/hosts/alias.test Mon Mar 02 20:40:10 2015 +0200
+++ b/etc/hosts/alias.test Mon Mar 02 21:46:27 2015 +0200
@@ -1,7 +1,9 @@
[foo]
ip = 127.0.0.1
- alias = test
+ alias = test1
+ alias4 = test
[bar]
ip = 127.0.0.2
- alias = test
+ alias = test2
+ alias4 = test
--- a/etc/hosts/asdf Mon Mar 02 20:40:10 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-[asdf{1-3}]
- ip = 10.100.100.$
--- a/etc/hosts/boot.dhcp Mon Mar 02 20:40:10 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-[foo]
- ethernet = 00:11:22:33:44:55
- boot = boot.lan:debian/wheezy/pxelinux.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/hosts/boot.test Mon Mar 02 21:46:27 2015 +0200
@@ -0,0 +1,9 @@
+boot.next-server = boot.test
+
+[foo]
+ ethernet = 00:11:22:33:44:55
+ boot = boot2.test:/debian/wheezy/pxelinux.0
+
+[bar]
+ ethernet = 00:11:22:33:44:55
+ boot.filename = /debian/jessie/pxelinux.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/hosts/dhcp-test Mon Mar 02 21:46:27 2015 +0200
@@ -0,0 +1,9 @@
+[foo]
+ [[asdf]]
+ ip = 10.1.0.1
+ ethernet.eth1 = 00:11:22:33:44:55
+
+[bar]
+ [[asdf]]
+ ip = 10.2.0.1
+ ethernet.eth2 = 55:44:33:22:11:00
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/hosts/dhcp.test Mon Mar 02 21:46:27 2015 +0200
@@ -0,0 +1,2 @@
+[foo]
+ ethernet = 00:11:22:33:44:55
--- a/etc/hosts/dhcp1 Mon Mar 02 20:40:10 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-[foo]
- ethernet = 00:11:22:33:44:55
--- a/etc/hosts/dhcp2 Mon Mar 02 20:40:10 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-[foo.dhcp]
- [[asdf]]
- ip = 10.1.0.1
- ethernet.eth1 = 00:11:22:33:44:55
-
-[bar.dhcp]
- [[asdf]]
- ip = 10.2.0.1
- ethernet.eth2 = 55:44:33:22:11:00
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/hosts/dyn.test Mon Mar 02 21:46:27 2015 +0200
@@ -0,0 +1,2 @@
+[dyn{1-8}]
+ ip = 10.1.16.$
--- a/etc/hosts/reverse Mon Mar 02 20:40:10 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-[foo-{240-247}]
- forward =
- reverse = $.240/29.0.0.10.in-addr.arpa
- ip = 10.0.0.$
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/hosts/reverse.test Mon Mar 02 21:46:27 2015 +0200
@@ -0,0 +1,4 @@
+[foo-{240-247}]
+ forward =
+ reverse = $.240/29.0.0.10.in-addr.arpa
+ ip = 10.0.0.$