STP vs RSTP: Port States and Roles, Convergence Speed

When switches are connected with redundant paths, broadcast frames keep circling the loop and cause a broadcast storm. STP (Spanning Tree Protocol) has switches exchange messages called BPDUs and blocks some ports so that the network forms a loop-free tree rooted at the root bridge. Classic STP (IEEE 802.1D), however, moves ports to the forwarding state while waiting on timers so that no loop forms, so with default values recovery after a failure takes 30 to 50 seconds. RSTP (Rapid STP, IEEE 802.1w) keeps the same root bridge election and the same idea of blocking ports, but cuts the switchover to generally a few seconds or less, using a proposal-and-agreement exchange with the neighboring switch and alternate ports chosen in advance. RSTP was incorporated into the 2004 edition of IEEE 802.1D and has replaced classic STP as the standard.

AspectSTPRSTP
StandardIEEE 802.1D (up to the 1998 edition)IEEE 802.1w; incorporated into the 2004 edition of IEEE 802.1D
Port statesFive: disabled, blocking, listening, learning, forwardingThree: discarding, learning, forwarding
Port rolesRoot port and designated port; ports that are neither are blockedRoot and designated ports, plus the alternate port (a stand-in for the root port) and the backup port (a spare for a designated port)
Recovery time after a failure30 to 50 seconds with default timers (max age 20 s + forward delay 15 s × 2)Generally a few seconds or less
Fast switchover mechanismNone; waits on timers and passes through listening and learning before forwardingOn point-to-point links, exchanges a proposal and an agreement with the neighbor and starts forwarding without waiting for timers; if the root port fails, an alternate port takes over immediately
How BPDUs are sent and failures detectedEach switch relays the BPDUs sent by the root bridge; a failure is assumed when BPDU information is not refreshed for the max age (20 s by default)Each switch sends its own BPDUs every hello time (2 s by default); a failure is assumed when three in a row are missed
How topology changes are signaledThe switch that notices the change tells the root bridge with a TCN BPDU, and the root bridge spreads it to all; MAC address tables drop old entries by shortening the aging time to the forward delay (15 s)The switch that notices the change tells its neighbors directly, and switches that receive it flush old MAC address table entries immediately
Ports for end devicesNot distinguished by the standard; a device plugged in waits about 30 seconds before forwarding startsA port configured as an edge port starts forwarding immediately; if it receives a BPDU, it is treated as a normal port
CompatibilityKeeps running as STP when connected to RSTP switchesOn ports facing STP switches, switches to STP-compatible behavior (switchover on that port becomes slow)

Figures are typical orders of magnitude and vary by process generation and product.

When to use which

STP
Kept for compatibility where old switches that do not support RSTP are present. There is almost no reason to choose classic STP for a new network.
RSTP
The standard choice for networks with redundantly connected switches. Configuring ports for end devices as edge ports and using full-duplex point-to-point links between switches gets the full benefit of fast switchover.

FAQ

Why does STP take 30 to 50 seconds to switch over?

Because it advances ports cautiously so that no loop forms. For a failure elsewhere in the network, it first waits the max age of 20 seconds for the stale BPDU information to expire. It then waits a forward delay of 15 seconds in each of the listening and learning states, for up to 20 + 15 × 2 = 50 seconds in total. When a link on the switch's own port fails, it does not need to wait for the max age, so it takes about 30 seconds.

Can RSTP and STP switches be mixed?

Yes. An RSTP switch switches to STP-compatible behavior on a port where it receives classic STP BPDUs. On that port, however, the proposal-and-agreement exchange is not available and the switch relies on timers, so switchover is slower. To get fast switchover, run RSTP on all switches in the network.

Is the root bridge chosen differently in STP and RSTP?

No, it is the same. The switch with the lowest bridge ID, made of the priority followed by the MAC address, becomes the root bridge. The default priority is 32768, so without configuration the switch with the lowest MAC address wins; it is therefore common to set a lower priority on the switch meant to be at the center.

What if I want a separate tree for each VLAN?

STP and RSTP build one tree for the whole network, so a blocked link is unused for every VLAN. MSTP (IEEE 802.1s, now part of IEEE 802.1Q) can build a separate tree (instance) for each group of VLANs, so different VLANs can use different links and redundant links are put to use.

Check your understanding

In a network where switches are connected with redundant paths, what role does the Spanning Tree Protocol (STP) play?

  1. AIt logically disables some ports so that the paths form a loop-free tree, preventing broadcast frames from circulating endlessly
  2. BIt spreads frames evenly over several links between switches to increase bandwidth
  3. CIt relays frames between different VLANs so that the VLANs can communicate with each other
Show answer and explanation

Answer: A. It logically disables some ports so that the paths form a loop-free tree, preventing broadcast frames from circulating endlessly

If switches are connected in a loop, broadcasts and frames to unknown destinations keep circulating and multiplying around the loop (a broadcast storm), and the network stops working. This happens because Ethernet frames have no mechanism like the IP TTL that counts hops and discards the frame. STP has the switches exchange messages called BPDUs and blocks some ports so that the active paths form a tree rooted at the root bridge. If a link in use fails, it moves a blocked port to the forwarding state to switch to another path.

In STP, the bridge IDs of three switches are known: SW1 has priority 32768 and MAC address 00-00-5E-00-53-01, SW2 has priority 61440 and MAC address 00-00-5E-00-53-05, and SW3 has priority 4096 and MAC address 00-00-5E-00-53-0A. Which switch is elected as the root bridge?

  1. ASW1
  2. BSW2
  3. CSW3
Show answer and explanation

Answer: C. SW3

In STP, the switch with the lowest bridge ID becomes the root bridge. The bridge ID puts the priority in the upper part and the MAC address in the lower part, so priorities are compared first and MAC addresses only when the priorities are equal. Here SW3, with the lowest priority of 4096, becomes the root bridge regardless of its MAC address. The default priority is 32768, and if nothing is configured the switch with the lowest MAC address is chosen, so it is common practice to give the switch at the center of the network a lower priority.

Three switches, SW1, SW2 and SW3, are connected in a triangle with one link between each pair. The STP root bridge is SW1, and SW2 has a lower bridge ID than SW3. All links have the same path cost. Which port is blocked (does not forward frames)?

  1. AThe port on SW1 that connects to SW3
  2. BThe port on SW2 that connects to SW3
  3. CThe port on SW3 that connects to SW2
Show answer and explanation

Answer: C. The port on SW3 that connects to SW2

All ports on the root bridge are designated ports in the forwarding state. SW2 and SW3 each choose as their root port the port with the lowest cost to the root bridge, which is the port connected directly to SW1. On the remaining SW2–SW3 link, both switches have the same cost to the root bridge (one link), so the port on SW2, which has the lower bridge ID, becomes the designated port. The port on SW3 is neither a root port nor a designated port, so it is blocked and the triangular loop is broken.

  1. With default timers, classic STP (IEEE 802.1D) takes about 30 to 50 seconds after a failure before a previously blocked port starts forwarding. Which mechanism lets RSTP switch over faster?

Practice Network Design and Operations questions

Key terms explained

Spanning Tree Protocol (STP)
A protocol (IEEE 802.1D) that, in a network where switches are connected with redundant paths, logically blocks some ports so that the paths form a loop-free tree, preventing broadcast storms. If a path in use fails, it switches over by using a port that was blocked. RSTP (Rapid Spanning Tree Protocol) is an improved version that switches over faster.
MAC address
The 48-bit address used in Ethernet and wireless LAN to identify devices within the same network. The upper 24 bits identify the manufacturer, and it is assigned to each interface at manufacture.
Broadcast domain
The range that a broadcast frame reaches. Switches and hubs forward broadcasts, so they belong to the same range, and routers (or routing on an L3 switch) mark its boundaries. With VLANs, a single switch can be divided into a separate broadcast domain for each VLAN. If the range is too large, broadcasts such as ARP increase and network efficiency drops.
VLAN
Virtual LAN. A function that creates logically separate networks (broadcast domains) on the same physical equipment, typically per switch port. Between switches, VLANs are distinguished by IEEE 802.1Q tags.
Ethernet
The family of standards (IEEE 802.3) for wired LANs. Data is placed in frames that are addressed by MAC address. It runs over twisted-pair cable and optical fiber at speeds from 10 Mbit/s to hundreds of Gbit/s. Each frame ends with a CRC-32 error-detection code, the frame check sequence (FCS). Today devices are normally connected to switches in full duplex, so the old CSMA/CD collision handling is no longer used.

Related comparisons