tero@438: = pvl-hosts = terom@34: tero@443: DNS/DHCP hosts management/integration for ISC bind9 and dhcpd. tero@443: tero@443: Also includes network SNMP discovery. tero@443: tero@443: == Hosts == tero@443: The `pvl.hosts-* etc/hosts/test` tools read hosts files as input, which have an ini format, using section names as hostnames to configure attributes for that host: tero@443: tero@443: [foo] tero@452: ip = 127.0.0.1 tero@452: ethernet = 00:11:22:33:44:55 tero@443: tero@443: [bar] tero@452: ip = 127.0.0.2 tero@452: ethernet = 01:23:45:67:89:ab tero@443: tero@443: The default mechanism uses the basename of the given config file as the domain name, so this example file would generate something like the following output for use in a `zone "test" { ... }` zonefile: tero@443: tero@443: $ pvl.hosts-dns --forward-zone=test etc/hosts/test tero@443: foo A 127.0.0.1 tero@443: bar A 127.0.0.2 tero@443: tero@443: And correspondingly, the reverse zone for 127.0.0.0/8: tero@443: tero@443: $ pvl.hosts-dns --reverse-zone=127 etc/hosts/test tero@443: 1.0.0 PTR foo.test. tero@443: 2.0.0 PTR bar.test. tero@443: tero@452: And the associated DHCP hosts: tero@452: tero@452: $ bin/pvl.hosts-dhcp etc/hosts/test tero@452: host foo { tero@480: option host-name foo; tero@480: hardware ethernet 00:11:22:33:44:55; tero@480: fixed-address 127.0.0.1; tero@452: } tero@452: tero@452: host bar { tero@480: option host-name bar; tero@480: hardware ethernet 01:23:45:67:89:ab; tero@480: fixed-address 127.0.0.2; tero@452: } tero@452: tero@484: === Host aliases === tero@484: Hosts can specify DNS aliases: tero@484: tero@484: [foo] tero@484: ip = 127.0.0.1 tero@484: alias = test1 tero@484: tero@484: [bar] tero@484: ip = 127.0.0.2 tero@484: alias = test2 tero@484: tero@484: $ bin/pvl.hosts-forward --forward-zone alias.test etc/hosts/alias.test tero@484: foo A 127.0.0.1 tero@484: test1 CNAME foo tero@484: bar A 127.0.0.2 tero@484: test2 CNAME bar tero@484: tero@447: === Generated hosts === tero@447: The hosts file format supports something similar to bind9's $GENERATE directive for hosts: tero@447: tero@447: [asdf{1-3}] tero@447: ip = 10.100.100.$ tero@447: tero@447: $ bin/pvl.hosts-dns --forward-zone=asdf etc/hosts/asdf tero@447: asdf1@asdf A 10.100.100.1 tero@447: asdf2@asdf A 10.100.100.2 tero@447: asdf3@asdf A 10.100.100.3 tero@447: tero@447: Note that the generate directives are interpreted and compiled directly by pvl.hosts. tero@447: tero@447: Most of the $GENERATE options should be supported, with a little clever hackery: tero@447: tero@447: [asdf{1-5/2}{0,2}] tero@447: ip = 10.100.100.$${10} tero@447: tero@447: $ bin/pvl.hosts-dns --forward-zone=asdf2 etc/hosts/asdf2 tero@447: asdf01@asdf2 A 10.100.100.11 tero@447: asdf03@asdf2 A 10.100.100.13 tero@447: asdf05@asdf2 A 10.100.100.15 tero@447: tero@448: This feature can be used for generating reverse delegations: tero@448: tero@448: [foo-{240-247}] tero@448: forward = tero@448: reverse = $.240/29.0.0.10.in-addr.arpa tero@448: ip = 10.0.0.$ tero@448: tero@448: $ bin/pvl.hosts-dns --reverse-zone=10 etc/hosts/reverse tero@448: 240.0.0 CNAME 240.240/29.0.0.10.in-addr.arpa. tero@448: 241.0.0 CNAME 241.240/29.0.0.10.in-addr.arpa. tero@448: 242.0.0 CNAME 242.240/29.0.0.10.in-addr.arpa. tero@448: 243.0.0 CNAME 243.240/29.0.0.10.in-addr.arpa. tero@448: 244.0.0 CNAME 244.240/29.0.0.10.in-addr.arpa. tero@448: 245.0.0 CNAME 245.240/29.0.0.10.in-addr.arpa. tero@448: 246.0.0 CNAME 246.240/29.0.0.10.in-addr.arpa. tero@448: 247.0.0 CNAME 247.240/29.0.0.10.in-addr.arpa. tero@480: tero@480: === DHCP Options === tero@480: The hosts need not specify any fixed ip address, leaving IP address allocation to dhcpd: tero@480: tero@480: [foo] tero@480: ethernet = 00:11:22:33:44:55 tero@480: tero@480: $ bin/pvl.hosts-dhcp etc/hosts/dhcp1 tero@480: host foo { tero@480: option host-name foo; tero@480: hardware ethernet 00:11:22:33:44:55; tero@480: } tero@480: tero@480: === DHCP Boot options === tero@480: The hosts can specify DHCP boot server/file options: tero@480: tero@480: [foo] tero@480: ethernet = 00:11:22:33:44:55 tero@480: boot = boot.lan:debian/wheezy/pxelinux.0 tero@480: tero@480: $ bin/pvl.hosts-dhcp etc/hosts/boot.dhcp tero@480: host foo { tero@480: option host-name foo; tero@480: hardware ethernet 00:11:22:33:44:55; tero@480: next-server boot.lan; tero@480: filename debian/wheezy/pxelinux.0; tero@480: } tero@480: tero@483: === DHCP hosts in multiple subnets/domains === tero@483: A host with different interfaces in multiple domains must specify unique interface names: tero@483: tero@483: [foo.dhcp] tero@483: [[asdf]] tero@483: ip = 10.1.0.1 tero@483: ethernet.eth1 = 00:11:22:33:44:55 tero@483: tero@483: [bar.dhcp] tero@483: [[asdf]] tero@483: ip = 10.2.0.1 tero@483: ethernet.eth2 = 55:44:33:22:11:00 tero@483: tero@483: $ bin/pvl.hosts-dhcp etc/hosts/dhcp2 tero@483: host asdf-eth1 { tero@483: option host-name asdf; tero@483: hardware ethernet 00:11:22:33:44:55; tero@483: fixed-address 10.1.0.1; tero@483: } tero@483: tero@483: host asdf-eth2 { tero@483: option host-name asdf; tero@483: hardware ethernet 55:44:33:22:11:00; tero@483: fixed-address 10.2.0.1; tero@483: } tero@483: