README
author Tero Marttila <tero.marttila@aalto.fi>
Tue, 24 Feb 2015 18:55:47 +0200
changeset 448 5ab0ec8200c3
parent 447 6f0357759e9b
child 452 d10f2b2188bb
permissions -rw-r--r--
README reverse delegation example
= pvl-hosts =

DNS/DHCP hosts management/integration for ISC bind9 and dhcpd.

Also includes network SNMP discovery.

== Hosts ==
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:

    [foo]
        ip  = 127.0.0.1

    [bar]
        ip  = 127.0.0.2

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:

    $ pvl.hosts-dns --forward-zone=test etc/hosts/test
    foo                               A     127.0.0.1
    bar                               A     127.0.0.2

And correspondingly, the reverse zone for 127.0.0.0/8:

    $ pvl.hosts-dns --reverse-zone=127 etc/hosts/test
    1.0.0                             PTR   foo.test.
    2.0.0                             PTR   bar.test.

=== 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. 

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

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.