]> git.sesse.net Git - nms/commitdiff
Add make-named-secondary.pl, adapted from TG05.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sun, 9 Apr 2006 22:04:12 +0000 (22:04 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sun, 9 Apr 2006 22:04:12 +0000 (22:04 +0000)
config/make-named-secondary.pl [new file with mode: 0755]

diff --git a/config/make-named-secondary.pl b/config/make-named-secondary.pl
new file mode 100755 (executable)
index 0000000..bef5aa2
--- /dev/null
@@ -0,0 +1,93 @@
+#! /usr/bin/perl -w
+use strict;
+
+# les inn nettnavn
+my %netnames = ();
+my %netmasks = ();
+my @nets = ();
+open NAMES, "switches.txt"
+or die "switches.txt: $!";
+while (<NAMES>) {
+       chomp;
+       /194\.0\.(\d+\.\d+)\s+(\d+)\s+(\S+)/ or next;
+       $netmasks{$1} = $2;
+       $netnames{$1} = $3;
+       push @nets, $1;
+}
+
+print <<"EOF";
+// Autogenerated by make-named.pl. Do not edit manually! 
+
+options {
+        directory "/etc/bind";
+       allow-query { any; };
+       allow-transfer { 194.19.3.20; 194.0.255.2; }; 
+       auth-nxdomain no;
+       recursion yes;
+
+//     forwarders { 194.19.2.11; 194.19.3.11; }; 
+//     forward only;
+};
+
+zone "." { type hint; file "db.root"; };
+
+zone "0.0.127.in-addr.arpa" {
+       type master;
+       file "0.0.127.in-addr.arpa";
+       notify no;
+};
+
+zone "tg06.gathering.org" {
+       type slave;
+       notify no;
+       masters { 194.0.254.2 };
+       file "tg06.gathering.org";
+};
+
+// serversubnett
+zone "255.0.194.in-addr.arpa" {
+       type slave;
+       notify no;
+       masters { 194.0.254.2 };
+       file "255.0.194.in-addr.arpa";
+       allow-transfer { 194.0.255.2; 193.0.0.0/22; };
+};
+
+zone "0.194.in-addr.arpa" {
+       type slave;
+       notify no;
+       masters { 194.0.254.2 };
+       allow-update { key DHCP_UPDATER; };
+       file "dynamic/0.194.in-addr.arpa";      
+       allow-transfer { 194.19.3.20; 194.0.255.2; 193.0.0.0/22; };
+};
+
+key DHCP_UPDATER {
+       algorithm HMAC-MD5.SIG-ALG.REG.INT;
+       secret 5Yz1azvh7mE0IRGffTvtKg==;
+};
+
+EOF
+
+for my $net (@nets) {
+       my $domain = $netnames{$net};
+       my @domains;
+       if ($domain =~ /^split:(.*)/) {
+               @domains = split /,/, $1;
+       } else {
+               @domains = ($domain);
+       }
+
+       for my $d (@domains) {
+               print <<"EOF";
+zone "$d.tg06.gathering.org" {
+       type slave;
+       notify no;
+       masters { 194.0.254.2 };
+       allow-update { key DHCP_UPDATER; };
+       file "dynamic/$d.tg06.gathering.org";
+       allow-transfer { 194.19.3.20; 194.0.255.2; };
+};
+EOF
+       }
+}