2.5 Interpret how Rapid PVST+ spanning tree operates
CCNA 200-301 v1.1 · 2.0 Network Access
Spanning tree stops Layer 2 loops by electing a root bridge and blocking the redundant ports that would close a loop. Rapid PVST+, the Cisco default on new switches, runs one Rapid STP (802.1w) instance per VLAN and converges in about a second. For the CCNA you predict the root and every port's role, and protect the edge with PortFast and the guards.
What you must know
- Work out the root bridge from bridge IDs, and make a switch root primary or secondary for a VLAN.
- Name each port's role (root, designated, alternate, backup) from costs and bridge IDs.
- Compare the RSTP states with the classic 802.1D states.
- Explain what PortFast changes and where it belongs.
- Choose between BPDU guard, BPDU filter, root guard and loop guard for a given problem.
Root bridge and port naming
Every switch has a bridge ID: a priority (default 32768) plus the VLAN number (the system ID extension), followed by its MAC address. The lowest bridge ID is the root. With default priorities the oldest switch, with the lowest MAC address, tends to win, so set the root on purpose.
spanning-tree mode rapid-pvst
spanning-tree vlan 10 root primary ! priority 24576, or lower than the current root
spanning-tree vlan 20 root secondary ! priority 28672
! or exact values, in steps of 4096:
spanning-tree vlan 10 priority 4096Then each non-root switch picks one root port: its port with the lowest cost to the root. Each segment gets one designated port: the end closest to the root. Ties are broken by the lowest neighbor bridge ID, then the lowest neighbor port ID (port priority, default 128, then port number).
| Link speed | Cost (short method) |
|---|---|
| 10 Mbps | 100 |
| 100 Mbps | 19 |
| 1 Gbps | 4 |
| 10 Gbps | 2 |
In the drawing every port on SW1 is designated, because the root's ports are always designated. SW2 and SW3 use Gi0/1 as their root port. On the SW2–SW3 link both have the same cost to the root, so SW2 wins with the lower bridge ID: its Gi0/2 is designated and SW3's Gi0/2 becomes the alternate port.
Port roles and states
| Role | What it is | State |
|---|---|---|
| Root | The best path to the root bridge, one per non-root switch. | Forwarding |
| Designated | The best port on a segment toward the root, one per segment. | Forwarding |
| Alternate | A second path to the root through another switch: the root port's ready-made replacement. | Discarding |
| Backup | A second port onto the same segment (rare: a hub). | Discarding |
| Disabled | Shut down. | Discarding |
RSTP has three states: discarding, learning and forwarding. Classic 802.1D had blocking, listening, learning and forwarding, and took 30 to 50 seconds. RSTP is fast because neighbors agree on roles with a proposal and agreement handshake on point-to-point links, and an alternate port becomes the root port immediately when the root port fails.
PortFast
A port with PortFast is an edge port: it goes straight to forwarding when a host connects, and its link going up or down does not trigger a topology change. Use it only on ports to end hosts, never toward another switch.
interface GigabitEthernet0/5
spanning-tree portfast
!
spanning-tree portfast default ! every access portRoot guard, loop guard, BPDU filter and BPDU guard
| Feature | Where | What it does |
|---|---|---|
| BPDU guard | PortFast edge ports | Err-disables the port when any BPDU arrives: someone plugged in a switch. |
| BPDU filter | Edge ports, with care | Stops sending BPDUs. Globally it only applies to PortFast ports and turns PortFast off if a BPDU arrives; on an interface it disables STP there, which can cause a loop. |
| Root guard | Designated ports toward the access layer | Puts the port in root-inconsistent (discarding) if a better BPDU arrives, so no switch down there can become root. |
| Loop guard | Root and alternate ports | Puts the port in loop-inconsistent if BPDUs stop, instead of letting it forward: protects against one-way links. |
interface GigabitEthernet0/5
spanning-tree portfast
spanning-tree bpduguard enable
!
interface GigabitEthernet0/24
spanning-tree guard root
!
errdisable recovery cause bpduguard ! optional automatic recoveryCommands
show spanning-tree vlan 10 | The root ID, this switch's bridge ID, and each port's role, state, cost and port ID. |
show spanning-tree root | The root bridge, cost and root port for every VLAN. |
show spanning-tree summary | Mode (rapid-pvst), and whether PortFast, BPDU guard and loop guard are on by default. |
show spanning-tree interface Gi0/1 detail | Everything about one port, including BPDUs sent and received. |
show interfaces status err-disabled | Ports shut by BPDU guard (or port security) and the reason. |
Exam traps
- The lowest bridge ID wins. A priority of 4096 beats 32768.
- Priority is set in steps of 4096 because the low 12 bits carry the VLAN ID: VLAN 10 at default priority shows 32778.
root primaryis calculated once, when you type it. A switch configured later with a lower priority still takes over.- Every port of the root bridge is designated. A root bridge has no root port.
- PortFast on a port to another switch can create a loop for a moment; BPDU guard is what stops it.
Check yourself
- SW1 has priority 32768 and MAC 0011.1111.1111; SW2 has priority 32768 and MAC 0011.0000.0001. Which is root for VLAN 1?
- SW2. The priorities tie (32769 with the VLAN), so the lower MAC address wins.
- A user plugs a small switch into a port with PortFast and BPDU guard. What happens?
- The small switch sends BPDUs, so BPDU guard err-disables the port. It stays down until it is shut and unshut, or errdisable recovery brings it back.
- What is the RSTP name for the 802.1D blocking state?
- Discarding.
- Which guard stops a switch in the access layer from becoming root?
- Root guard, on the distribution switch's designated ports toward the access layer.
Labs
Try it live: Rapid PVST+ root bridge tuning
More topics in 2.0 Network Access
- 2.1 Configure and verify VLANs that span several switches
- 2.2 Configure and verify links between switches
- 2.3 Configure and verify CDP and LLDP neighbor discovery
- 2.7 Describe how APs, WLCs and switch ports are physically connected, including LAG
- 2.8 Describe ways to manage network devices: console, Telnet, SSH, HTTP(S), TACACS+/RADIUS, cloud
- 2.9 Interpret the WLC GUI settings that control client connectivity: WLANs, security, QoS, advanced