Protocoles STP et RSTP : Guide Complet
Protocoles STP et RSTP : Guide Complet
protocoles STP et
RSTP
U n d e r s t a n d i n g STP a n d RSTP Protocols
1 Introduction
2 Concepte fondamentaux
5 Mécanismes d'optimisation et de
sécurité
6 Implémentation et
v é r i fi c a t i o n
Introduction
Explorer les fondations des réseaux sans boucle
Introduction
EthernetDéfis
La redondance physique améliore la fiabilité mais crée des risques de boucles de couche 2
Les boucles non gérées inondent les commutateurs avec des trames de diffusion (tempêtes
réseau)Solutions
Protocol Solutions
STP RSTP
Élimine les boucles en créant un arbre Convergence plus rapide (quelques
logique (convergence en 30-50 sec) secondes) avec les mêmes principes
Critical Concepts
que STP (normalisé en 2001)
Redondance : Assure la tolérance aux pannes mais nécessite une prévention
des boucles
Technical Focus Role STP/RSTP : Bloque dynamiquement les chemins redondants tout en
maintenant des routes de secours
BPDU (Bridge Protocol Data Unit): messages de contrôle pour le
Broadcast Storms: Les boucles non contrôlées dégradent les
calcul de topologie
performances ; STP les atténue en désactivant les liens redondants
1-2s
Evolution a Rapid-STP
De secondes à sub-secondes : Le saut de convergence Amélioration Port Statut
STP (802.1D) Path
Blocking Listening Learning Forwarding
Core Enhancements
Handshake Mechanism
Propose/Agree Une séquence Proposer/Approuver sur les liaisons
point à point permet une transition immédiate du port vers l'état de
transmission, contournant les temporisateurs.
Ponts (Commutateurs)
Segmentent les domaines de collision mais créent un seul Root Bridge
domaine de diffusion, nécessitant une prévention des boucles.
Root Port Root Port
Domaines de diffusion
STP/RSTP assure qu'un seul chemin actif existe pour prévenir les
Switch A Switch B
tempêtes de diffusion paralysant le ré[Link] Blocked Port
Les boucles non contrôlées provoquent des tempêtes de diffusion et une Définit la fonction : Racine, Désigné ou Bloqué
Port Roles
congestion du réseau. STP atténue cela, tandis que RSTP accélère la pour la prévention des [Link]
convergence..
Fundamental Concepts
BPDU
A control message used by STP/RSTP to exchange network topology
Election Logic
information, containing root ID, path cost, and port roles.
1 Root Bridge
Switch with the lowest Bridge ID (BID) is elected.
BID
A unique switch identifier composed of Priority + MAC . The lowest BID 2 Root Port
wins the root bridge election. On non-root switches, the port with the lowest path
Example: 32768.d4c9.ef12.3456 cost to the root bridge.
3 Designated Port
Port ID One per network segment, determined by the best
A port-specific value made of Priority + Interface # , used as the BPDU received on that segment.
final tie-breaker in STP elections.
4 Blocked Ports
All other ports (Alternate/Backup) are blocked to
prevent loops.
Critical Values
Configuration Note
Default timers are conservative. Adjust them carefully based on network size,
Max Age ≥ 2 × (Forward Delay + 1) topology, and specific Service Level Agreement (SLA) requirements.
Comparison Logic:
1. Lowest Priority value wins.
2. If priorities are equal, the lowest MAC address wins.
Process Flow
S2 S3 S4
1 Claim Root MAC: 0002... MAC: 0003... MAC: 0004...
All switches initially claim to be the root by sending Result: S1 wins root due to the lowest MAC address (assuming default priority 32768 for all).
Root Port: Direct link to Root. Blocked Port: Redundant path.
BPDUs.
2 Compare BIDs
Switches exchange and compare Bridge ID (BID) values Optimization Tip
from received BPDUs.
To ensure a specific switch becomes the root, manually configure its priority to
3 Elect Root a lower value. A common practice is setting it to 4096 , making its election
The switch with the lowest overall BID is elected as the deterministic and predictable.
STP 802.1D Detailed Operation
Calculation Steps
Topology Scenario Root Bridge Selection: The switch with the lowest Bridge ID (BID) is
1
elected. (S1 in this case)
Root Port Selection: On non-root switches, the port with the minimal
S1 (Root Bridge) 2
BID: [Link] cumulative path cost to the root is chosen.
Cost: 200,000 Cost: 200,000
Designated Port Assignment: On each network segment, the port that
3
S2 S3 sends the best BPDU is assigned as designated.
Blocking Ports: All other ports that are not root or designated are put into
4
a blocking state to prevent loops.
S4
Key Formula
Port Roles & States
Root Ports: S2-F0/1, S3-F0/1, S4-F0/1
Cumulative Cost = Sum of individual link costs from the switch to the root
bridge. Link cost is inversely proportional to its bandwidth.
Designated
All ports on S1
Ports:
Blocked S2-F0/2, S3-F0/2 (on redundant link)
Ports:
Refer to Annex A for the complete cost table and detailed topology
diagram.
RSTP 8 0 2 . 1 w E n h a n c e m e n t s
Accel er ati ng Network C o n v e rg e n c e a n d
Stability
RSTP 802.1w Enhancements
Blocking / Port discards data frames and does not learn MAC
Rapid Handshake Discarding
Listening addresses.
A Proposal/Agreement mechanism allows point-
to- point ports to quickly transition to forwarding, Port discards data frames but learns MAC
bypassing the traditional timer-based delays. Learning Learning
addresses to populate the CAM table.
Elected on non-root switches, this port provides the lowest cumulative path cost
to
the root bridge. It is the single best path towards the ROOT
root.
BRIDGE
S1
D D
Designated Port FORWARDING
Selected for each network segment. It forwards BPDUs and traffic onto
the segment. All ports on the root bridge are designated ports.
BLOCKED
A
S2 R R S4 D
A backup for the root port. It provides a redundant path to the root bridge
but remains in a discarding state until the primary path fails. D R
S3
Operational Insights
New Discarding State: RSTP merges STP’s Blocking/Listening into a single Discarding
state.
Roles ensure a loop-free topology while enabling rapid
Role Determination: Roles are decided via BPDU comparison (Bridge ID, path cost, Port
failover.
ID).
RSTP 802.1w Enhancements
2. Agreement Returned
If conditions are met, the receiving port blocks all other ports and
returns an Agreement BPDU.
3. Immediate Forwarding
The link immediately transitions to the Forwarding state, bypassing the
traditional 30-second Listen/Learn delay.
Point-to-Point Link
The handshake mechanism requires a direct connection between two switch ports.
Full-Duplex Operation
The link must be operating in full-duplex mode to prevent collisions.
Convergence time is reduced from 30–50 seconds in STP
Optimization a n d Security
MechanisE nm
h a ns
c i n g Network St abi l i t y a n d
Protection
Optimization and Security Mechanisms
Comparative Summary
Root Guard Receives a superior BPDU Blocks the port Manual (threat removal)
Loop Guard Stops receiving BPDUs Blocks the port Automatic (BPDUs resume)
Optimization and Security Mechanisms
Tx Rx BPDU
Operational Modes
Key Function
Aggressive: Automatically attempts to re-establish the link; if it fails, the
port is shut down. Scope: Applies to all STP/RSTP ports, including designated and root
ports.
Normal: Marks the port as unidirectionally linked but requires manual
Action: Blocks ports if BPDUs are no longer received, preventing
intervention to resolve.
stale topology information from causing loops.
Debugging Commands
Cisco IOS-XE: Example & Action
show spanning-tree vlan [ID]: Displays port roles, costs, and Sample Log Indicating LoopGuard Action:
states.
debug spanning-tree events: Provides real-time BPDU exchange Bridge ID 32768.d4c9.ef12.3456
Port Gi1/0/4: Role: Alternate | State: Reject (LoopGuard)
monitoring.
Core/Distribution/Access Topology
Best Practices
Root Placement
Set Core switches as primary/backup roots for optimal
Core Layer
pathing (BID optimization). High-Speed
Backbone
Link Protection Priority: 4096 (Primary Root)
Use UDLD & Loop Guard on critical fiber links (Core- Example: 10G Links (Cost: 2000 )
Distribution).
Uplink Security
Enable Root Guard on uplinks from Access to
Distribution layers.
Distribution Layer
Convergence
Aggregation & Policy
RSTP Enabled Control
Priority: 8192 (Backup Root)
Achieve sub-second failover on point-to-point links. Example: 1G Links (Cost: 20000 )
Command Snippet
Access Layer
Design Strategies and Best Practices
STP (802.1D)
~50s RSTP (802.1w)
<1s
Sequentially passes through Listening and Learning Uses rapid Propose/Agree handshake to bypass
states upon link failure. intermediate states.
Testing Prerequisite
Ensure UDLD and Loop Guard are disabled for
accurate baseline convergence measurements.
Practical Exercises and Quiz
Self-Assessment Questions
1. STP Basics 3. RSTP Mechanisms
What is the primary purpose of the Spanning Tree Protocol (STP) in Describe the "Propose/Agree" handshake process in RSTP and
a switched Ethernet network? its impact on convergence time.
Define BID (Bridge ID) and explain how it influences root bridge What are the roles of Backup and Alternate ports in RSTP
election. topology?
* Answers should reference STP/RSTP principles, timer settings, and security mechanisms. *