README
changeset 514 f19d86b20f24
parent 512 dafac309813e
child 516 9615ffc647a0
equal deleted inserted replaced
513:3b45b4fd5102 514:f19d86b20f24
    40         option host-name bar;
    40         option host-name bar;
    41         hardware ethernet 01:23:45:67:89:ab;
    41         hardware ethernet 01:23:45:67:89:ab;
    42         fixed-address 192.0.2.2;
    42         fixed-address 192.0.2.2;
    43     }
    43     }
    44 
    44 
    45 === Includes ===
    45 === Include directories ===
    46 Host configs can be included:
    46 Host configs can be included:
    47 
    47 
    48     $ cat etc/hosts/includes.test
    48     $ cat etc/hosts/test/test
    49     include = includes.test.d/
    49     include = test.d/
    50 
    50 
    51     [quux]
    51     $ cat etc/hosts/test/test.d/foo 
    52         ip  = 192.0.2.3
       
    53 
       
    54     $ cat etc/hosts/includes.test.d/foo 
       
    55     ip = 192.0.2.1
    52     ip = 192.0.2.1
    56 
    53 
    57     $ cat etc/hosts/includes.test.d/bar 
    54     $ cat etc/hosts/test/test.d/bar 
    58     ip = 192.0.2.2
    55     ip = 192.0.2.2
    59 
    56 
    60     $ ./opt/bin/python bin/pvl.hosts-forward --forward-zone test etc/hosts/includes.test
    57     $ bin/pvl.hosts-forward --forward-zone test etc/hosts/test/test
    61     foo.includes                      A     192.0.2.1
    58     foo                               A     192.0.2.1
    62     bar.includes                      A     192.0.2.2
    59     bar                               A     192.0.2.2
    63     quux.includes                     A     192.0.2.3
    60 
       
    61 And an entire directory of hosts-files, containing sub-domains, can be given:
       
    62 
       
    63     $ ls etc/hosts/test/
       
    64     asdf.test  test  test.d
       
    65 
       
    66     $ cat etc/hosts/test/asdf.test 
       
    67     [quux]
       
    68         ip  = 192.0.2.5
       
    69 
       
    70     $ bin/pvl.hosts-forward --forward-zone test etc/hosts/test/
       
    71     foo                               A     192.0.2.1
       
    72     bar                               A     192.0.2.2
       
    73     quux.asdf                         A     192.0.2.5
       
    74 
       
    75 Note that the (include) directory name itself is NOT treated as a domain name. However, the file names which are included are.
       
    76 
       
    77 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:
       
    78 
       
    79     $ cat etc/hosts/wrong.test 
       
    80     include = wrong.d/
       
    81     
       
    82     $ etc/hosts/wrong.d/host
       
    83     [host]
       
    84         ip  = 192.0.2.6
       
    85 
       
    86     $ bin/pvl.hosts-forward --forward-zone test etc/hosts/wrong.test 
       
    87     host.host.wrong                   A     192.0.2.6
    64 
    88 
    65 === Host aliases ===
    89 === Host aliases ===
    66 Hosts can specify DNS aliases:
    90 Hosts can specify DNS aliases:
    67 
    91 
    68     [foo]
    92     [foo]