From 07d92d8b9eeb73d1813e67a66b2bcb467a559407 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Apr 2007 12:14:40 +0200 Subject: [PATCH] Make some config stuff for Net. --- config/make-port-config.pl | 65 ++++++++++++++++++++++++++++++++++++++ make-all-config.sh | 2 +- static-switches.txt | 2 +- 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 config/make-port-config.pl diff --git a/config/make-port-config.pl b/config/make-port-config.pl new file mode 100644 index 0000000..769c580 --- /dev/null +++ b/config/make-port-config.pl @@ -0,0 +1,65 @@ +#! /usr/bin/perl +open PATCHLIST, ") { + chomp; + my ($name, $distro, $port) = split / /; + + $name =~ /e(\d+)-(\d+)/; + my ($row, $switch) = ($1, $2); + + my $ip; + if ($switch == 1) { + $ip = "87.76." . ($row - 1) . "1"; + } elsif ($switch == 2) { + $ip = "87.76." . ($row - 1) . "65"; + } elsif ($switch == 3) { + $ip = "87.76." . ($row - 1) . "129"; + } elsif ($switch == 4) { + $ip = "87.76." . $row . "1"; + } elsif ($switch == 5) { + $ip = "87.76." . $row . "65"; + } elsif ($switch == 6) { + $ip = "87.76." . $row . "129"; + } + + my $vlan = "$row$switch"; + + $distros{$distro} .= <<"EOF"; +vlan $vlan + name $name +! +default interface vlan $vlan +interface $vlan + description $name + ip address $ip 255.255.255.192 + ip directed-broadcast 10 + ip helper-address 87.76.254.2 + no ip proxy-arp + no shutdown +! + +default interface $port +interface $port + description $name + switchport mode access + switchport access vlan $vlan + + spanning-tree portfast + spanning-tree bpduguard enable + + ip igmp snooping + storm-control broadcast level 2 + no shutdown + +EOF +} + +for my $distro (keys %distros) { + open DISTRO, ">$distro-config" + or die "$distro-config: $!"; + print DISTRO $distros{$distro}; + close DISTRO; +} diff --git a/make-all-config.sh b/make-all-config.sh index 5a8c893..b97e043 100755 --- a/make-all-config.sh +++ b/make-all-config.sh @@ -6,4 +6,4 @@ cat static-switches.txt >> switches.txt ./config/make-named-secondary.pl | ssh root@insert 'cat > /etc/bind/named.conf' ./config/make-missing-zones.pl (cd mbd && ./generate-helper-list.pl > ../mbd-ports) -scp mbd-ports sesse@f1:/tftpboot/portcfg/ +scp mbd-ports *-config sesse@f1:/tftpboot/portcfg/ diff --git a/static-switches.txt b/static-switches.txt index 78f32bb..5fdf245 100644 --- a/static-switches.txt +++ b/static-switches.txt @@ -8,7 +8,7 @@ 87.76.205.0 24 infodesk-inngang 87.76.206.0 24 crewcare 87.76.207.0 24 auditorium -87.76.208.0 24 billettbu +87.76.208.0 24 ute 87.76.209.0 24 infodesk 87.76.210.0 24 game-server 87.76.212.0 24 game-client -- 2.39.2