From 0b85ec00a69ec9ee942b426b8d92c4effca175d9 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 1 Apr 2007 00:13:43 +0200 Subject: [PATCH] Changes for TG07; update IPs and remove option 82 stuff. --- config/make-dhcpd.pl | 130 ++++++++++--------------------------------- config/make-named.pl | 18 +++--- 2 files changed, 39 insertions(+), 109 deletions(-) diff --git a/config/make-dhcpd.pl b/config/make-dhcpd.pl index b31820d..876e5cb 100755 --- a/config/make-dhcpd.pl +++ b/config/make-dhcpd.pl @@ -1,60 +1,43 @@ #! /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; + /87\.76\.(\d+\.\d+)\s+(\d+)\s+(\S+)/ or next; + push @nets, { + net => $1, + netmask => $2, + name => $3 + }; } print <<"EOF"; # Autogenerated by make-dhcpd.pl. Do not edit manually! -option domain-name "tg06.gathering.org"; -option domain-name-servers 194.0.254.2; +option domain-name "tg07.gathering.org"; +option domain-name-servers 87.76.254.2, 87.76.255.2; -# ddns-update-style none; ddns-update-style interim; - -# extra logging for option 82 -if exists agent.circuit-id -{ - log ( - info, - concat ( - "option-82 info for ", binary-to-ascii (16, 8, ":", hardware), - ": interface ", binary-to-ascii (10, 8, "/", suffix ( option agent.circuit-id, 2)), - ", VLAN ", binary-to-ascii (10, 16, "", substring( option agent.circuit-id, 2, 2)), - ", switch '", substring( option agent.remote-id, 2, 6), - "', port-name '", substring ( option agent.circuit-id, 2, extract-int ( substring ( option agent.circuit-id, 3, 1 ), 8 ) ), - "'" - ) - ); -} +omapi-port 7911; # dnssec-keygen -a HMAC-MD5 -b 128 -n HOST DHCP_UPDATER key DHCP_UPDATER { algorithm HMAC-MD5.SIG-ALG.REG.INT; - secret 5Yz1azvh7mE0IRGffTvtKg==; + secret F388UOhaIIKHRH9TDE5PTA==; } default-lease-time 14400; max-lease-time 28800; # Tele-nett -subnet 194.0.254.0 netmask 255.255.255.0 { +subnet 87.76.254.0 netmask 255.255.255.0 { } # Server-nett -subnet 194.0.255.0 netmask 255.255.255.0 { +subnet 87.76.255.0 netmask 255.255.255.0 { } zone 0.194.in-addr.arpa. { @@ -65,97 +48,44 @@ zone 0.194.in-addr.arpa. { EOF for my $net (@nets) { - my $domain = $netnames{$net}; + my $domain = $net->{name}; my ($netmask, $numpc); - if ($netmasks{$net} == 24) { + if ($net->{netmask} == 24) { $netmask = "255.255.255.0"; $numpc = 256; - } elsif ($netmasks{$net} == 25) { + } elsif ($net->{netmask} == 25) { $netmask = "255.255.255.128"; $numpc = 128; - } elsif ($netmasks{$net} == 26) { + } elsif ($net->{netmask} == 26) { $netmask = "255.255.255.192"; $numpc = 64; } else { - die "Unknown netmask /$netmasks{$net}"; + die "Unknown netmask /" . $net->{netmask}; } - $net =~ /(\d+)\.(\d+)/ or die "Unknown net $net"; + $net->{net} =~ /(\d+)\.(\d+)/ or die "Unknown net $net"; my ($majorsubnet,$minorsubnet) = ($1,$2); - - my $gw = "194.0.$majorsubnet." . ($minorsubnet + 1); - my $rangestart = "194.0.$majorsubnet." . ($minorsubnet + 10); - my $rangeend = "194.0.$majorsubnet." . ($minorsubnet + $numpc - 2); - - if ($domain =~ /^split:(.*)/) { - my @domains = split /,/, $1; - for my $d (@domains) { - print <<"EOF"; -zone $d.tg06.gathering.org. { - primary 127.0.0.1; - key DHCP_UPDATER; -} -EOF - } - print <<"EOF"; -subnet 194.0.$net netmask $netmask { - authoritative; - option routers $gw; -EOF - my $numpc_sub = int($numpc / scalar(@domains)); - for my $d (@domains) { - print <<"EOF"; - class "$d" { - match if substring ( option agent.circuit-id, 2, extract-int ( substring ( option agent.circuit-id, 3, 1 ), 8 ) ) = "$d"; - } -EOF - } - - my $i = 0; - for my $d (@domains) { - my $rangestart = "194.0.$majorsubnet." . ($minorsubnet + $i * $numpc_sub + 10); - my $rangeend = "194.0.$majorsubnet." . ($minorsubnet + $i * $numpc_sub + $numpc_sub - 2); - - print <<"EOF"; - pool { - allow members of "$d"; - range $rangestart $rangeend; - option domain-name "$d.tg06.gathering.org tg06.gathering.org"; - ddns-domainname "$d.tg06.gathering.org"; - ignore client-updates; - } -EOF - ++$i; - } - } else { - print <<"EOF"; -zone $domain.tg06.gathering.org. { + # FIXME: Should use Net::CIDR + my $gw = "87.76.$majorsubnet." . ($minorsubnet + 1); + my $rangestart = "87.76.$majorsubnet." . ($minorsubnet + 10); + my $rangeend = "87.76.$majorsubnet." . ($minorsubnet + $numpc - 2); + + print <<"EOF"; +zone $domain.tg07.gathering.org. { primary 127.0.0.1; key DHCP_UPDATER; } -subnet 194.0.$net netmask $netmask { +subnet 87.76.$net->{net} netmask $netmask { authoritative; option routers $gw; range $rangestart $rangeend; - option domain-name "$domain.tg06.gathering.org tg06.gathering.org"; - ddns-domainname "$domain.tg06.gathering.org"; + option domain-name "$domain.tg07.gathering.org"; + ddns-domainname "$domain.tg07.gathering.org"; ignore client-updates; +} EOF - - # hack for sesse =) - if ($net eq '250.0') { - print <<"EOF"; - host trofast { - hardware ethernet 00:0e:0c:36:a7:66; - filename "/pxelinux.0"; - next-server 194.0.255.25; - } -EOF - } - } - - print "}\n"; } + diff --git a/config/make-named.pl b/config/make-named.pl index 2099b64..91efaa9 100755 --- a/config/make-named.pl +++ b/config/make-named.pl @@ -37,32 +37,32 @@ zone "0.0.127.in-addr.arpa" { notify no; }; -zone "tg06.gathering.org" { +zone "tg07.gathering.org" { type master; - file "tg06.gathering.org"; + file "tg07.gathering.org"; notify yes; allow-transfer { 194.0.255.2; }; }; // serversubnett -zone "255.0.194.in-addr.arpa" { +zone "255.76.87.in-addr.arpa" { type master; - file "255.0.194.in-addr.arpa"; + file "255.76.87.in-addr.arpa"; notify yes; allow-transfer { 194.0.255.2; 193.0.0.0/22; }; }; -zone "0.194.in-addr.arpa" { +zone "76.87.in-addr.arpa" { type master; allow-update { key DHCP_UPDATER; }; notify yes; - file "dynamic/0.194.in-addr.arpa"; + file "dynamic/76.87.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==; + secret F388UOhaIIKHRH9TDE5PTA==; }; EOF @@ -78,11 +78,11 @@ for my $net (@nets) { for my $d (@domains) { print <<"EOF"; -zone "$d.tg06.gathering.org" { +zone "$d.tg07.gathering.org" { type master; allow-update { key DHCP_UPDATER; }; notify yes; - file "dynamic/$d.tg06.gathering.org"; + file "dynamic/$d.tg07.gathering.org"; allow-transfer { 194.19.3.20; 194.0.255.2; }; }; EOF -- 2.39.2