Sub topic 11
Reading spanning tree output
This chapter assumes you know how switches learn MAC addresses and how VLANs and trunks work. It also assumes you have met root bridge election, path cost and port roles earlier in this tutorial. The goal here is to read show spanning-tree output quickly and turn it into answers. Which switch is the root? Why is this port blocked? Is the topology stable?
The commands and what each answers
| Command | Question it answers |
|---|---|
| `show spanning-tree vlan 10` | Who is the root, and what role and state does each port have in VLAN 10? |
| `show spanning-tree summary` | Which mode is running, and how many ports are in each state per VLAN? |
| `show spanning-tree interface Gi0/1 detail` | Why is this port in its current role, and how often does it change? |
| `show spanning-tree inconsistentports` | Has a guard feature blocked any port? |
Start with vlan N. Use the other commands to dig into whatever looks wrong.
Reading the per-VLAN view
This output comes from a non-root switch running Rapid PVST+:
SW2# show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 4106
Address 0011.2233.4401
Cost 4
Port 1 (GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 0011.2233.4402
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Root FWD 4 128.1 P2p
Gi0/2 Altn BLK 4 128.2 P2p
Gi0/5 Desg FWD 4 128.5 P2p EdgeRead it in this order.
- Protocol line.
rstpmeans Rapid PVST+.ieeemeans classic per-VLAN STP (PVST+). A mismatch between switches is worth noticing. - Root ID block. This describes the root bridge, not this switch. The priority 4106 is the configured 4096 plus the VLAN number 10, the extended system ID. The
Cost 4is this switch's root path cost.Port 1 (GigabitEthernet0/1)is its root port. On the root bridge itself, this block is replaced by the lineThis bridge is the root. - Bridge ID block. This describes the local switch. Here the priority is the default 32768 plus 10, which gives 32778. Compare the two Priority and Address values. If they match, this switch is the root.
- Timers. The Root ID timers are the ones in effect. Non-root switches adopt the root's timers, so check that block.
- Port table. One row per port taking part in the tree.
Decoding the port table
| Column | Values | Meaning |
|---|---|---|
| Role | `Root`, `Desg`, `Altn`, `Back` | Root port, designated port, alternate path to the root, backup of a designated port on the same segment |
| Sts | `BLK`, `LIS`, `LRN`, `FWD` | Blocking or discarding, listening, learning, forwarding. Classic STP uses all four. Rapid STP shows only `BLK`, `LRN` and `FWD`. |
| Cost | 2, 4, 19, 100 | Port cost. With the short method, 10 Gbps is 2, 1 Gbps is 4, 100 Mbps is 19 and 10 Mbps is 100. |
| Prio.Nbr | `128.5` | Port priority plus port number, used as the last tie-breaker |
| Type | `P2p`, `Shr`, `Edge`, `Peer(STP)` | Full duplex point-to-point link, shared half duplex link, PortFast edge port, or a neighbor running classic STP |
Two interpretation rules cover most cases. Every segment has exactly one designated port. Every non-root switch has exactly one root port. An Altn BLK port is the expected second path, so it is not a fault. A switch with no Altn or Back ports has no redundant path in that VLAN.
In the example, Gi0/1 leads to the root with cost 4, so the root is directly connected. Gi0/2 offers an equal-cost second path. The tie was broken upstream, so this port is blocked. Gi0/5 faces a host, shows Edge, and is forwarding.
Following the diagnosis
Port detail and topology changes
The detail form explains why a port holds its role and whether the topology is changing:
SW2# show spanning-tree interface GigabitEthernet0/1 detail
Port 1 (GigabitEthernet0/1) of VLAN0010 is root forwarding
Port path cost 4, Port priority 128, Port Identifier 128.1.
Designated root has priority 4106, address 0011.2233.4401
Designated bridge has priority 4106, address 0011.2233.4401
Designated port id is 128.1, designated path cost 0
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
BPDU: sent 412, received 3590Check these lines:
- Designated bridge and designated port id. They identify the neighbor sending the best BPDU on this segment.
- Transitions to forwarding state. A count that keeps rising means the link flaps.
- BPDU sent and received. A port that receives many BPDUs and sends few is a non-designated port. A port that receives none from a neighbor that should send them points to a one-way link or a filtered VLAN.
- Link type. "By default" means it was derived from duplex. A half-duplex link falls back to shared and loses the rapid handshake.
For topology changes, run show spanning-tree vlan 10 detail. It includes lines like Number of topology changes 3 last change occurred 00:01:12 ago and from GigabitEthernet0/5. Run it twice a minute apart. A stable network shows the counter standing still. If it climbs, follow the from port toward the switch that is flapping.
Summary and guard output
SW2# show spanning-tree summary
Switch is in rapid-pvst mode
Root bridge for: none
Portfast Default is disabled
Name Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0010 1 0 0 2 3This is a quick sanity check. In Rapid PVST+, the Listening column is always 0. Large Listening or Learning counts that persist indicate classic STP behavior or instability.
A guard-blocked port appears as BKN* in the Sts column of the VLAN view, and show spanning-tree inconsistentports names the reason:
SW2# show spanning-tree inconsistentports
Name Interface Inconsistency
-------------------- ---------------------- ------------------
VLAN0010 GigabitEthernet0/24 Root InconsistentRoot Inconsistent means Root Guard saw a superior BPDU. Other values are Loop Inconsistent (Loop Guard stopped BPDUs arriving) and PVST Inconsistent (a trunk-type mismatch).
Exercise
A switch shows Bridge ID Priority 32778 and a Root ID block with Priority 4106 and Cost 8, Port 3 (GigabitEthernet0/3). The port table lists Gi0/3 as Root FWD, Gi0/4 as Altn BLK and Gi0/10 as Desg FWD ... P2p Edge. For which VLAN was this output taken, is this switch the root, and how many gigabit hops away is the root?
Show answer
The VLAN is 10, because both priorities are a multiple of 4096 plus 10 (32768 + 10 and 4096 + 10). The switch is not the root, because the Root ID differs from the Bridge ID, and the output does not say "This bridge is the root". With the short cost method, a gigabit link costs 4, so a root path cost of 8 means two gigabit hops. Gi0/4 is a blocked alternate path, and Gi0/10 is a PortFast host port.