β οΈ Prima di leggere: hai usato show spanning-tree vlan 10 e show spanning-tree vlan 20 su tutti e tre gli switch? Chi Γ¨ il root bridge?
BUG 1
SW2-Dist Γ¨ root bridge per VLAN 10 β SW1-Core ha priority errata
π Come identificarlo:
SW1# show spanning-tree vlan 10
VLAN0010
Root ID Priority 1 β SW1 ha priority 1 (troppo bassa = Γ¨ root!)
Address aabb.cc00.0100
This bridge is the root
SW2# show spanning-tree vlan 10
VLAN0010
Root ID Priority 1 Address aabb.cc00.0100
Root port: Gi1/0/1 (costo 4)
SW1# show run | section spanning-tree
spanning-tree vlan 10 priority 1 β priority non standard!
π§ Fix β imposta SW1 come root corretto con priority standard:
SW1# conf t
SW1(config)# spanning-tree vlan 10 priority 4096
SW1(config)# spanning-tree vlan 20 priority 4096
oppure in modo piΓΉ diretto:
SW1(config)# spanning-tree vlan 10 root primary
SW1(config)# spanning-tree vlan 20 root primary
PerchΓ© funziona: priority 1 non Γ¨ un valore standard STP (deve essere multiplo di 4096). Sebbene IOS lo accetti, porta SW1 a essere root con una priority anomala che puΓ² causare comportamenti imprevisti. La priority 4096 Γ¨ il valore standard raccomandato per il root bridge primario β inferiore al default 32768 degli altri switch ma conforme alle specifiche.
BUG 2
SW3 Gi1/0/1 β PortFast abilitato su porta trunk verso SW1
π Come identificarlo:
SW3# show spanning-tree vlan 10 detail
GigabitEthernet1/0/1 is designated forwarding
Port path cost 4, Port priority 128
The port is in the portfast mode
Number of transitions to forwarding state: 3
SW3# show run | section interface Gi1/0/1
interface GigabitEthernet1/0/1
switchport mode trunk
spanning-tree portfast β PortFast su porta trunk!
π§ Fix:
SW3# conf t
SW3(config)# interface GigabitEthernet1/0/1
SW3(config-if)# no spanning-tree portfast
PerchΓ© funziona: PortFast bypassa i stati Listening e Learning di STP, portando la porta direttamente in Forwarding. Questo Γ¨ sicuro su porte access verso singoli host. Su una porta trunk verso un altro switch, il bypass STP puΓ² creare loop temporanei durante la convergenza perchΓ© la porta inizia a forwardare prima che STP abbia completato il calcolo del loop-free path.
BUG 3
SW3 Fa0/1 β BPDU Guard mette in err-disabled la porta dell'IP phone
π Come identificarlo:
SW3# show interfaces status
Port Status Vlan Duplex Speed
Fa0/1 err-disabled 10 a-full 100
SW3# show interfaces Fa0/1
FastEthernet0/1 is down, line protocol is down (err-disabled)
Last event: BPDU received on PortFast-enabled port
SW3# show run | section interface Fa0/1
interface FastEthernet0/1
switchport mode access
switchport access vlan 10
spanning-tree portfast
spanning-tree bpduguard enable β blocca i BPDU dell'IP phone!
π§ Fix β rimuovi BPDU Guard dalla porta dell'IP phone e recupera la porta:
SW3# conf t
SW3(config)# interface FastEthernet0/1
SW3(config-if)# no spanning-tree bpduguard enable
SW3(config-if)# end
SW3# errdisable recovery cause bpduguard
oppure per forzare subito:
SW3# shutdown (poi no shutdown su Fa0/1)
PerchΓ© funziona: BPDU Guard mette la porta in err-disabled appena riceve un BPDU. Γ progettato per le porte PortFast verso host che non dovrebbero mai generare BPDU. Un IP phone con switch integrato (CDP-aware) genera BPDU propri verso lo switch di accesso β comportamento normale e atteso. La soluzione Γ¨ rimuovere BPDU Guard da questa porta (l'IP phone Γ¨ un dispositivo affidabile, non un loop non autorizzato).
π§ Come ragionare su un problema STP
Passo 1 β Chi Γ¨ il root bridge?
show spanning-tree vlan X su tutti gli switch β guarda "This bridge is the root". Il root bridge dovrebbe sempre essere lo switch piΓΉ potente (core), non un access switch.
Passo 2 β Porte in err-disabled
show interfaces status β cerca "err-disabled". Poi show interfaces Fa0/X per il motivo specifico (bpduguard, portfast, etc.).
Passo 3 β PortFast su porte sbagliate?
show spanning-tree detail β cerca "The port is in the portfast mode". PortFast su porte trunk Γ¨ sempre sbagliato.
Passo 4 β Priority corretta?
show spanning-tree vlan X β la priority del root Γ¨ un multiplo di 4096? Priority 1, 2, 3 sono valori non standard che possono creare instabilitΓ .
π Concetti chiave β STP
Elezione Root Bridge
Bridge ID = Priority (2 byte) + MAC (6 byte)
Priority default: 32768
Vince il Bridge ID piΓΉ basso
Priority deve essere multiplo di 4096
Comandi: priority 4096 o root primary
Stati porta STP
Blocking: riceve BPDU, non forwarda
Listening: partecipa all'elezione
Learning: impara MAC, non forwarda
Forwarding: traffico normale
PortFast: salta Listening/Learning
PortFast
Bypassa Listening e Learning.
β
Solo su porte access verso host
β Mai su porte trunk verso switch
Rischio: se riceve BPDU β loop
BPDU Guard complementa PortFast
BPDU Guard
Mette porta in err-disabled se riceve BPDU.
β
Su porte access PortFast verso host fidati
β Non su porte con dispositivi che generano BPDU legittimi (IP phone con switch)
Recovery: errdisable recovery cause bpduguard
show spanning-tree β root bridge, ruolo porte (Root/Desg/Altn)
show spanning-tree vlan <X> β dettaglio per singola VLAN
show spanning-tree detail β PortFast, cost, transitions
show interfaces status β err-disabled?
show interfaces <fa0/1> β causa err-disabled
show run | section spanning-tree β priority, portfast, bpduguard
errdisable recovery cause bpduguard β auto-recovery err-disabled
π Teoria β Bug 1: priority non standard
STP usa il Bridge ID (BID) per eleggere il root bridge β vince il BID piΓΉ basso. Il BID Γ¨ composto da priority (2 byte) + MAC address (6 byte). La priority deve essere un multiplo di 4096 (0, 4096, 8192, ..., 61440). Una priority di 1, 2 o 3 Γ¨ tecnicamente accettata da IOS ma non Γ¨ conforme alle specifiche IEEE 802.1D e puΓ² causare comportamenti imprevisti in ambienti misti. Il valore corretto per il root primario Γ¨ 4096 (o usare il macro-comando spanning-tree vlan X root primary che imposta 24576 o il valore minimo necessario per battere gli altri switch).
π Teoria β Bug 2: PortFast su porta trunk
PortFast Γ¨ progettato esclusivamente per porte verso end-device (PC, stampanti, server) che non partecipano mai a STP. Quando una porta trunk con PortFast va up, inizia immediatamente a forwardare senza aspettare la convergenza STP. Se quel link crea un loop nella topologia, il loop esiste per il tempo necessario a STP per convergere β tipicamente 30 secondi, durante i quali un loop puΓ² saturare la rete. IOS mostra un warning quando si configura PortFast su una porta trunk, ma lo consente ugualmente.
π Teoria β Bug 3: BPDU Guard e IP phone
Gli IP phone Cisco con switch integrato (modello CDP) possono generare BPDU verso lo switch di accesso β questo Γ¨ comportamento normale e serve a partecipare al processo STP locale. BPDU Guard non distingue tra BPDU "pericolosi" (da switch non autorizzati) e BPDU "legittimi" (da IP phone). Quando abilitato su Fa0/1, BPDU Guard vede il BPDU dell'IP phone come una violazione e mette la porta in err-disabled. La soluzione Γ¨ rimuovere BPDU Guard dalla porta e lasciare solo PortFast β oppure usare spanning-tree bpdufilter enable per scartare silenziosamente i BPDU senza err-disabled.
π¬π§ English version β Cisco official terminology for CCNA exam preparation.
BUG 1
SW1-Core has non-standard STP priority (1) β causes suboptimal root election
π How to identify:
SW1# show spanning-tree vlan 10
VLAN0010
Root ID Priority 1 β non-standard value!
This bridge is the root
SW1# show run | section spanning-tree
spanning-tree vlan 10 priority 1
π§ Fix:
SW1# configure terminal
SW1(config)# spanning-tree vlan 10 priority 4096
SW1(config)# spanning-tree vlan 20 priority 4096
or using the macro command:
SW1(config)# spanning-tree vlan 10 root primary
Why this works: STP bridge priority must be a multiple of 4096 per IEEE 802.1D. A priority of 1 is accepted by IOS but is non-standard and can cause unpredictable behavior in mixed vendor environments. Priority 4096 correctly makes SW1 the root while remaining compliant with the standard.
π Key concept β STP root bridge election
β’ Bridge ID (BID) = Priority (2B) + MAC address (6B)
β’ Lowest BID wins β becomes root bridge
β’ Priority must be a multiple of 4096 (0, 4096, 8192... 61440)
β’ Default priority: 32768
β’ Recommended root: spanning-tree vlan X root primary (sets 24576 or lower)
BUG 2
SW3 Gi1/0/1 β PortFast enabled on a trunk port toward SW1
π How to identify:
SW3# show spanning-tree detail
GigabitEthernet1/0/1 is designated forwarding
The port is in the portfast mode
SW3# show run | section interface Gi1/0/1
interface GigabitEthernet1/0/1
switchport mode trunk
spanning-tree portfast β portfast on trunk!
π§ Fix:
SW3# configure terminal
SW3(config)# interface GigabitEthernet1/0/1
SW3(config-if)# no spanning-tree portfast
Why this works: PortFast skips the Listening and Learning states, moving the port directly to Forwarding. On access ports toward hosts, this is safe and desirable. On trunk ports toward switches, it creates a window where the port forwards traffic before STP has computed a loop-free topology β potentially causing temporary loops during convergence.
π Key concept β PortFast placement rules
β’ β
Access ports toward PCs, servers, printers
β’ β Never on trunk ports toward other switches
β’ β Never on ports that could receive BPDUs from unknown switches
β’ IOS warns when portfast is configured on a trunk
β’ Use BPDU Guard alongside PortFast for protection
BUG 3
SW3 Fa0/1 β BPDU Guard causes err-disabled on IP phone port
π How to identify:
SW3# show interfaces status
Fa0/1 err-disabled 10
SW3# show interfaces FastEthernet0/1
FastEthernet0/1 is down, line protocol is down (err-disabled)
Last event: BPDU received on PortFast port
SW3# show run | section Fa0/1
interface FastEthernet0/1
spanning-tree portfast
spanning-tree bpduguard enable
π§ Fix:
SW3# configure terminal
SW3(config)# interface FastEthernet0/1
SW3(config-if)# no spanning-tree bpduguard enable
SW3(config-if)# end
SW3# errdisable recovery cause bpduguard
Why this works: BPDU Guard shuts down a PortFast port the moment it receives any BPDU. Cisco IP phones with an integrated switch send BPDUs β this is expected behavior, not a rogue device. Removing BPDU Guard allows the phone's BPDUs to be received without triggering err-disabled. PortFast can remain for fast host connectivity.
π Key concept β BPDU Guard vs BPDU Filter
β’ BPDU Guard: err-disables port on BPDU receipt β use on host ports only
β’ BPDU Filter: silently drops BPDUs β use when device legitimately generates them
β’ err-disabled recovery: errdisable recovery cause bpduguard
β’ Recovery time: errdisable recovery interval 300 (300s default)
β’ Or manual: shut β no shut on the interface
π―
Exam Practice β STP Troubleshooting
3 questions Β· CCNA 200-301 style Β· answer before checking
0/3
Q1.
A network engineer wants SW1-Core to always be the root bridge for VLAN 10. Which command ensures this, even if a new switch with default settings is added?
A) spanning-tree vlan 10 priority 32768
B) spanning-tree vlan 10 root primary
C) spanning-tree vlan 10 forward-time 0
D) spanning-tree vlan 10 max-age 0
Q2.
An administrator sees the message "The port is in the portfast mode" in show spanning-tree detail for a trunk port connecting two switches. What is the risk?
A) The port will not form a trunk β PortFast prevents 802.1Q encapsulation
B) The port transitions to forwarding immediately without completing the STP convergence process, risking temporary loops
C) The port will generate excessive BPDUs and cause CPU spikes on adjacent switches
D) PortFast on a trunk port blocks all VLAN traffic above VLAN 100
Q3.
A switch port with PortFast and BPDU Guard enters err-disabled state immediately after being connected to an IP phone. The IP phone has an integrated switch. What is the correct solution?
A) Replace the IP phone β it is generating unauthorized STP traffic
B) Remove BPDU Guard from the port β the IP phone legitimately generates BPDUs and should not trigger err-disabled
C) Remove PortFast from the port β BPDU Guard only triggers on PortFast ports
D) Enable BPDU Filter instead to prevent the port from sending or receiving BPDUs entirely