]> git.sesse.net Git - nms/blob - config/make-named-secondary.pl
Add the link net to reverse DNS.
[nms] / config / make-named-secondary.pl
1 #! /usr/bin/perl -w
2 use strict;
3
4 my $date = `date --rfc-2822`;
5 chomp $date;
6
7 my @nets = ();
8 open NAMES, "switches.txt"
9         or die "switches.txt: $!";
10 while (<NAMES>) {
11         chomp;
12         /87\.76\.(\d+\.\d+)\s+(\d+)\s+(\S+)/ or next;
13         push @nets, {
14                 net => $1,
15                 netmask => $2,
16                 name => $3
17         };
18 }       
19
20 print <<"EOF";
21 // Autogenerated by make-named-secondary.pl at $date. Do not edit manually! 
22
23 options {
24         directory "/etc/bind";
25         allow-query { any; };
26         allow-transfer { 194.19.3.20; }; 
27         auth-nxdomain no;
28         recursion yes;
29
30 //      forwarders { 194.19.2.11; 194.19.3.11; }; 
31 //      forward only;
32 };
33
34 zone "." { type hint; file "db.root"; };
35
36 zone "0.0.127.in-addr.arpa" {
37         type master;
38         file "0.0.127.in-addr.arpa";
39         notify no;
40 };
41
42 zone "tg07.gathering.org" {
43         type slave;
44         notify no;
45         masters { 87.76.254.2; };
46         file "tg07.gathering.org";
47 };
48
49 // linknett
50 zone "0.76.87.in-addr.arpa" {
51         type slave;
52         notify no;
53         masters { 87.76.254.2; };
54         file "0.76.87.in-addr.arpa";
55         allow-transfer { 193.0.0.0/22; };
56 };
57
58 // linknett
59 zone "174.76.87.in-addr.arpa" {
60         type slave;
61         notify no;
62         masters { 87.76.254.2; };
63         file "174.76.87.in-addr.arpa";
64         allow-transfer { 193.0.0.0/22; };
65 };
66
67 // nett-subnett
68 zone "239.76.87.in-addr.arpa" {
69         type slave;
70         notify no;
71         masters { 87.76.254.2; };
72         file "239.76.87.in-addr.arpa";
73         allow-transfer { 193.0.0.0/22; };
74 };
75
76 // serversubnett
77 zone "254.76.87.in-addr.arpa" {
78         type slave;
79         notify no;
80         masters { 87.76.254.2; };
81         file "254.76.87.in-addr.arpa";
82         allow-transfer { 193.0.0.0/22; };
83 };
84 zone "255.76.87.in-addr.arpa" {
85         type slave;
86         notify no;
87         masters { 87.76.254.2; };
88         file "255.76.87.in-addr.arpa";
89         allow-transfer { 193.0.0.0/22; };
90 };
91
92 zone "76.87.in-addr.arpa" {
93         type slave;
94         notify no;
95         masters { 87.76.254.2; };
96         allow-update { key DHCP_UPDATER; };
97         file "dynamic/76.87.in-addr.arpa";      
98         allow-transfer { 194.19.3.20; 193.0.0.0/22; };
99 };
100
101 key DHCP_UPDATER {
102         algorithm HMAC-MD5.SIG-ALG.REG.INT;
103         secret 5Yz1azvh7mE0IRGffTvtKg==;
104 };
105
106 EOF
107
108 for my $net (@nets) {
109         my $d = $net->{name};
110
111         print <<"EOF";
112 zone "$d.tg07.gathering.org" {
113         type slave;
114         notify no;
115         masters { 87.76.254.2; };
116         allow-update { key DHCP_UPDATER; };
117         file "dynamic/$d.tg07.gathering.org";
118         allow-transfer { 194.19.3.20; };
119 };
120 EOF
121 }