From 1c5970d3e515385c87a34e43463d593b1aa91796 Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Sun, 30 Aug 2009 19:02:59 +0200 Subject: [PATCH] [switchs.py] Utilisation de nouvelles features des switches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignore-this: cc9c1e80009975a99f12f7101a6d0b5f Nommément, les features sont : - Le DHCP Snooping (filtrage des requêtes/réponses DHCP par port) - La loop-detection (désactivation de prises lors de détection de boucle, plus simple que le STP) - Nettoyage pour générer des config compatibles avec les séries 2600 et 2610 Pour que la configuration fonctionne correctement sur les switches de la série 2600, l'OS H10.74 ou supérieur est préconisé. darcs-hash:20090830170259-ffbb2-5d6e0f26e23e246f2e915f82fbae480d3d98bf85.gz --- gestion/gen_confs/switchs.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/gestion/gen_confs/switchs.py b/gestion/gen_confs/switchs.py index 1a190b7f..5aaa7ccf 100644 --- a/gestion/gen_confs/switchs.py +++ b/gestion/gen_confs/switchs.py @@ -53,7 +53,7 @@ sntp unicast ;-------------------------------------------------------- Misc console inactivity-timer 30 ;-------------------------------------------------------- Logs -logging 10.231.136.7 +logging 10.231.136.12 ;-------------------------------------------------------- IP du switch ip default-gateway 10.231.136.4 vlan %(vlan_adherent)s @@ -106,21 +106,31 @@ no web-management aaa authentication ssh login public-key none aaa authentication ssh enable public-key none ip ssh -ip ssh version 2 ip authorized-managers 10.231.136.0 255.255.255.0 ip ssh filetransfer ;------------------------------------------------------- Spanning-tree -spanning-tree protocol-version rstp +spanning-tree force-version rstp-operation ; Config des uplinks -no spanning-tree %(uplinks)s edge-port +no spanning-tree %(uplinks)s admin-edge-port spanning-tree %(uplinks)s point-to-point-mac true spanning-tree %(uplinks)s priority 6 ; Config des prises adhérent -spanning-tree %(non_uplinks)s edge-port +spanning-tree %(non_uplinks)s admin-edge-port spanning-tree %(non_uplinks)s point-to-point-mac auto spanning-tree %(non_uplinks)s priority 8 ; On active spanning-tree +;------------------------------------------------------- DHCP Snooping +dhcp-snooping vlan %(vlan_adherent)s +dhcp-snooping trust %(uplinks)s +no dhcp-snooping trust %(non_uplinks)s +dhcp-snooping authorized-server %(dhcp)s +; Activation +dhcp-snooping +;------------------------------------------------------- Protection contre les boucles +loop-protect disable-timer 30 +loop-protect transmit-interval 3 +loop-protect %(non_uplinks)s ;------------------------------------------------------- Serveurs radius radius-server dead-time 2 radius-server key %(radius_key)s @@ -143,6 +153,9 @@ exit rad_servs = [ '10.231.136.72', '10.231.136.9' ] rad_template = "radius-server host %s\n" + # Serveur DHCP du vlan par défaut + dhcp_server = "138.231.136.9" + def __init__(self,truc): """ truc est soit : * une _liste_ de chambres => reconfig de ces chambres @@ -269,7 +282,8 @@ exit rad = self.rad_template * len(self.rad_servs) params = { 'switch' : switch, 'bat' : bat.upper() , 'radius_key' : radius_key , - 'radius-serveurs' : rad[:-1] % tuple(self.rad_servs)} + 'radius-serveurs' : rad[:-1] % tuple(self.rad_servs), + 'dhcp': self.dhcp_server} self.aff.cycle()