STP and variantes : design without boucle
STP (Spanning Tree Protocol) est le protocole historique (1990) for éviter les boucles L2 dans les networkx redondants. Plusieurs variantes : STP, RSTP, MST, PVST+. En 2026, toujours déployé en campus access/aggregation malgré l'émergence d'EVPN-VXLAN. Guide of variantes, best practices, troubleshooting.
Problème résolu par STP
Without STP, 2 liens redondants entre 2 switchs = boucle L2 catastrophique :
- Broadcast storm : chaque broadcast re-transmis infiniment
- MAC table instability : même MAC vu sur ports multiples
- Résultat : switch saturé en <1 minute, network down
Variantes STP
STP classique (802.1D, 1990)
- Convergence : 30-50 secondes (listening → learning → forwarding)
- 1 instance spanning tree for tous les VLAN
- Obsolète, ne plus usesr
RSTP (Rapid STP, 802.1w, 2001)
- Convergence : 1-3 secondes
- Rôles ports : Root, Designated, Alternate, Backup
- Proposal/Agreement for convergence rapide
- Remplace STP classique
MSTP (Multiple STP, 802.1s, 2002)
- Groupes de VLAN mappés to instanthese STP
- Jusqu'à 64 instanthese par région MST
- Load-balancing VLAN-based (ex : VLAN 10-50 sur Switch A, VLAN 51-100 sur Switch B)
- Standard multi-vendor
PVST+ / Rapid-PVST+ (Cisco propriétaire)
- 1 instance STP par VLAN (Per-VLAN Spanning Tree)
- Très flexible mais CPU-intensive to grande échelle
- Compatible Cisco uniquement
Rôles ports RSTP
- Root port (RP) : vers le root bridge, 1 par switch non-root
- Designated port (DP) : forward sur chaque segment, 1 par segment
- Alternate port : backup of root port (forward instantané si RP tombe)
- Backup port : backup of designated port
Root bridge : le switch central
- Élu par priority (défaut 32768) + MAC (tiebreaker)
- Priority paramétrable par pas de 4096
- Best practice : forcer priority sur core switch (priority 8192)
- Secondary root : 2ème core with priority 16384
- NE JAMAIS laisser la priority par défaut — un access switch pourrait devenir root !
Configuration Cisco best practices
- spanning-tree mode rapid-pvst (ou mst for multi-vendor)
- spanning-tree vlan 1-4094 priority 8192 (sur core primaire)
- spanning-tree vlan 1-4094 priority 16384 (sur core secondaire)
- interface range gi1/0/1-48 ; spanning-tree portfast : ports endpoints
- interface range gi1/0/1-48 ; spanning-tree bpduguard enable : security
- spanning-tree loopguard default : protection contre unidirectional links
- spanning-tree bpduguard default (mode global alternative)
PortFast + BPDU Guard
Combo obligatoire sur ports access endpoints :
- PortFast : port en forward immédiat (skip listening/learning)
- BPDU Guard : err-disable si BPDU reçu (user ayant connecté un switch !)
- Évite : boucle accidentelle via switch domestique branché par user
- Re-activation : errdisable recovery cause bpduguard + timeout
Root Guard
- Prévient qu'un switch voisin devienne root
- Config : interface gi1/0/48 ; spanning-tree guard root
- Applique sur ports vers switchs non-dédiés core/agg
Loop Guard vs UDLD
- Loop Guard : évite boucles sur liens optiques one-way
- UDLD (Unidirectional Link Detection) : détection active via hello packets
- Recommandé sur liens fibre : aggressive UDLD + loop guard
STP design campus typique
- Core = root primary (priority 8192) + root secondary (16384)
- Distribution : forward toutes les VLAN
- Access : ports endpoints en PortFast + BPDU Guard
- Load-balancing VLAN : PVST+ or MST with 2 instances
Évolution : without STP
- SD-Access : fabric LISP/VXLAN, pas de STP
- EVPN-VXLAN campus : routed access, pas de STP sur uplink
- MLAG/VSS : regroupement 2 switchs = 1 logique, pas de STP inter-switch
- Cisco StackWise Virtual : 2 Catalyst 9500 = 1, pas de STP
Troubleshooting
- show spanning-tree : état global
- show spanning-tree vlan 10 detail : détails instance
- show spanning-tree bridge : priorité locale
- show spanning-tree inconsistentports : ports err-disabled BPDU
- show errdisable recovery : recovery config
- debug spanning-tree events (attention prod)
Commander chez OPTINOC
Design STP campus or migration vers routed access/SD-Access. Catalyst 9300 configurés with best practithese PortFast/BPDU Guard. Audit STP offert. Devis sous 48h.
