README
author Tero Marttila <tero.marttila@aalto.fi>
Thu, 26 Feb 2015 19:26:15 +0200
changeset 521 06792c78067e
parent 520 0310e199435a
child 522 6bc714379a13
permissions -rw-r--r--
setup and document etc/zone/ structure
438
d45fc43c6073 split out pvl-hosts from pvl-verkko
Tero Marttila <tero.marttila@aalto.fi>
parents: 34
diff changeset
     1
= pvl-hosts =
34
491f7da9d29b pvl.verkko-dhcp: fix polling without syslog; README
Tero Marttila <terom@paivola.fi>
parents:
diff changeset
     2
443
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
     3
DNS/DHCP hosts management/integration for ISC bind9 and dhcpd.
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
     4
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
     5
Also includes network SNMP discovery.
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
     6
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
     7
== Hosts ==
512
dafac309813e README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents: 509
diff changeset
     8
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
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
     9
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
    10
    [foo]
512
dafac309813e README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents: 509
diff changeset
    11
        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
    12
        ethernet    = 00:11:22:33:44:55
443
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
    13
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
    14
    [bar]
512
dafac309813e README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents: 509
diff changeset
    15
        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
    16
        ethernet    = 01:23:45:67:89:ab
443
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
    17
520
0310e199435a README: fixup --zone-prefix=
Tero Marttila <tero.marttila@aalto.fi>
parents: 516
diff changeset
    18
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
    19
    
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
    20
    $ 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
    21
    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
    22
    bar                               A     192.0.2.2
443
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
    23
520
0310e199435a README: fixup --zone-prefix=
Tero Marttila <tero.marttila@aalto.fi>
parents: 516
diff changeset
    24
And correspondingly, the reverse zone for `2.0.192.in-addr.arpa`:
443
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
    25
520
0310e199435a README: fixup --zone-prefix=
Tero Marttila <tero.marttila@aalto.fi>
parents: 516
diff changeset
    26
    $ 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
    27
    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
    28
    2                                 PTR   bar.example.com.
443
Tero Marttila <tero.marttila@aalto.fi>
parents: 438
diff changeset
    29
452
d10f2b2188bb README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents: 448
diff changeset
    30
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
    31
512
dafac309813e README: update to use example.com 192.0.2.0/24
Tero Marttila <tero.marttila@aalto.fi>
parents: 509
diff changeset
    32
    $ 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
    33
    host foo {
480
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
    34
        option host-name foo;
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
    35
        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
    36
        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
    37
    }
d10f2b2188bb README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents: 448
diff changeset
    38
d10f2b2188bb README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents: 448
diff changeset
    39
    host bar {
480
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
    40
        option host-name bar;
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
    41
        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
    42
        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
    43
    }
d10f2b2188bb README etc/hosts/test with ethernet and pvl.hosts-dhcp output
Tero Marttila <tero.marttila@aalto.fi>
parents: 448
diff changeset
    44
514
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    45
=== 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
    46
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
    47
521
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
    48
    $ cat etc/hosts/test
514
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    49
    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
    50
521
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
    51
    $ 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
    52
    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
    53
521
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
    54
    $ 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
    55
    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
    56
521
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
    57
    $ bin/pvl.hosts-forward etc/hosts/test
514
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    58
    foo                               A     192.0.2.1
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    59
    bar                               A     192.0.2.2
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
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
    62
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    63
    $ cat etc/hosts/wrong.test 
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    64
    include = wrong.d/
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    65
    
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    66
    $ etc/hosts/wrong.d/host
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    67
    [host]
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    68
        ip  = 192.0.2.6
f19d86b20f24 README: document includes
Tero Marttila <tero.marttila@aalto.fi>
parents: 512
diff changeset
    69
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
    70
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
    71
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
    72
    $ 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
    73
    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
    74
484
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    75
=== Host aliases ===
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    76
Hosts can specify DNS aliases:
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    77
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    78
    [foo]
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    79
        ip          = 127.0.0.1
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    80
        alias       = test1
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    81
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    82
    [bar]
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    83
        ip          = 127.0.0.2
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    84
        alias       = test2
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    85
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    86
    $ bin/pvl.hosts-forward --forward-zone alias.test etc/hosts/alias.test 
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
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    89
    bar                               A     127.0.0.2
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    90
    test2                             CNAME bar
099dee149e74 document host alias=
Tero Marttila <tero.marttila@aalto.fi>
parents: 483
diff changeset
    91
447
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
    92
=== Generated hosts ===
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
    93
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
    94
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
    95
    [asdf{1-3}]
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
    96
        ip  = 10.100.100.$
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
    97
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
    98
    $ bin/pvl.hosts-dns --forward-zone=asdf etc/hosts/asdf 
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
    99
    asdf1@asdf                        A     10.100.100.1
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   100
    asdf2@asdf                        A     10.100.100.2
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   101
    asdf3@asdf                        A     10.100.100.3
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   102
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   103
Note that the generate directives are interpreted and compiled directly by pvl.hosts. 
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   104
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   105
Most of the $GENERATE options should be supported, with a little clever hackery:
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   106
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   107
    [asdf{1-5/2}{0,2}]
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   108
       ip  = 10.100.100.$${10}
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   109
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   110
    $ bin/pvl.hosts-dns --forward-zone=asdf2 etc/hosts/asdf2
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   111
    asdf01@asdf2                      A     10.100.100.11
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   112
    asdf03@asdf2                      A     10.100.100.13
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   113
    asdf05@asdf2                      A     10.100.100.15
6f0357759e9b pvl.hosts: fixup and document host expansion
Tero Marttila <tero.marttila@aalto.fi>
parents: 443
diff changeset
   114
448
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   115
This feature can be used for generating reverse delegations:
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   116
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   117
    [foo-{240-247}]
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   118
        forward =
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   119
        reverse = $.240/29.0.0.10.in-addr.arpa
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   120
        ip      = 10.0.0.$
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   121
    
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   122
    $ bin/pvl.hosts-dns --reverse-zone=10 etc/hosts/reverse 
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   123
    240.0.0                           CNAME 240.240/29.0.0.10.in-addr.arpa.
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   124
    241.0.0                           CNAME 241.240/29.0.0.10.in-addr.arpa.
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   125
    242.0.0                           CNAME 242.240/29.0.0.10.in-addr.arpa.
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   126
    243.0.0                           CNAME 243.240/29.0.0.10.in-addr.arpa.
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   127
    244.0.0                           CNAME 244.240/29.0.0.10.in-addr.arpa.
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   128
    245.0.0                           CNAME 245.240/29.0.0.10.in-addr.arpa.
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   129
    246.0.0                           CNAME 246.240/29.0.0.10.in-addr.arpa.
5ab0ec8200c3 README reverse delegation example
Tero Marttila <tero.marttila@aalto.fi>
parents: 447
diff changeset
   130
    247.0.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
   131
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   132
=== DHCP Options ===
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   133
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
   134
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   135
    [foo]
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   136
        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
   137
    
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   138
    $ bin/pvl.hosts-dhcp etc/hosts/dhcp1 
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   139
    host foo {
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   140
        option host-name foo;
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   141
        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
   142
    }
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   143
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   144
=== DHCP Boot options ===
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   145
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
   146
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   147
    [foo]
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   148
        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
   149
        boot        = boot.lan:debian/wheezy/pxelinux.0
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   150
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   151
    $ bin/pvl.hosts-dhcp etc/hosts/boot.dhcp 
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   152
    host foo {
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   153
        option host-name foo;
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   154
        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
   155
        next-server boot.lan;
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   156
        filename debian/wheezy/pxelinux.0;
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   157
    }
7e44854e85d4 README and test host boot= and dynamic ip=
Tero Marttila <tero.marttila@aalto.fi>
parents: 452
diff changeset
   158
483
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   159
=== DHCP hosts in multiple subnets/domains ===
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   160
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
   161
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   162
    [foo.dhcp]
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   163
        [[asdf]]
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   164
            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
   165
            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
   166
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   167
    [bar.dhcp]
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   168
        [[asdf]]
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   169
            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
   170
            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
   171
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   172
    $ bin/pvl.hosts-dhcp etc/hosts/dhcp2 
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   173
    host asdf-eth1 {
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   174
        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
   175
        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
   176
        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
   177
    }
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   178
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   179
    host asdf-eth2 {
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   180
        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
   181
        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
   182
        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
   183
    }
19d084bb4afd pvl.hosts.dhcp: test and document hosts on multiple networks
Tero Marttila <tero.marttila@aalto.fi>
parents: 480
diff changeset
   184
521
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   185
== Host structure ==
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   186
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   187
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
   188
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   189
    $ tree etc/zones/
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   190
    etc/zones/
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   191
    ├── forward
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   192
    │   └── test
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   193
    │       ├── asdf.test -> ../../../hosts/asdf.test
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   194
    │       └── test -> ../../../hosts/test
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   195
    └── reverse
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   196
        └── 192.0.2
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   197
            ├── asdf.test -> ../../../hosts/asdf.test
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   198
            └── test -> ../../../hosts/test
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   199
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   200
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
   201
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   202
    $ 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
   203
    foo                               A     192.0.2.1
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   204
    bar                               A     192.0.2.2
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   205
    quux.asdf                         A     192.0.2.5
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   206
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   207
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
   208
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   209
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
   210
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   211
    $ 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
   212
    1                                 PTR   foo.test.
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   213
    2                                 PTR   bar.test.
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   214
    5                                 PTR   quux.asdf.test.
06792c78067e setup and document etc/zone/ structure
Tero Marttila <tero.marttila@aalto.fi>
parents: 520
diff changeset
   215