From: Steinar H. Gunderson Date: Sun, 9 Apr 2006 22:04:12 +0000 (+0000) Subject: Add make-named-secondary.pl, adapted from TG05. X-Git-Url: https://git.sesse.net/?p=nms;a=commitdiff_plain;h=5ef5f2c1c7b9f33f85bf0efeebfe69fe30750a44 Add make-named-secondary.pl, adapted from TG05. --- diff --git a/config/make-named-secondary.pl b/config/make-named-secondary.pl new file mode 100755 index 0000000..bef5aa2 --- /dev/null +++ b/config/make-named-secondary.pl @@ -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 () { + 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 + } +}