+#! /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
+ }
+}