Rapid Spanning Tree Protocol

Also known as: RSTP

On this page 7

Rapid Spanning Tree Protocol (RSTP) is the IEEE 802.1w standard that prevents Layer 2 loops in switched Ethernet networks while converging in a few seconds or less after a topology change. It replaced the original Spanning Tree Protocol, whose convergence typically took 30 to 50 seconds, and has been incorporated into IEEE 802.1D-2004 and later into IEEE 802.1Q.

Networking engineers rely on RSTP in Ethernet & switching designs that use redundant links between switches. Redundancy protects against cable and switch failures, but without a loop-prevention protocol a single loop creates a broadcast storm that can saturate every link within seconds. RSTP keeps exactly one active path between any two points and blocks the redundant ports, then unblocks them quickly when the active path fails.

How RSTP builds a loop-free topology

RSTP builds a logical tree over a physically meshed network by electing one root bridge and calculating the lowest-cost path from every switch to it. Switches exchange Bridge Protocol Data Units (BPDUs) that carry the bridge ID, root bridge ID and accumulated path cost.

The bridge ID combines a configurable priority value, in steps of 4,096 with a default of 32,768, and the switch MAC address. The switch with the lowest bridge ID becomes root. Every other switch selects one root port with the best path toward the root, and every segment selects one designated port that forwards toward it. Any remaining port becomes an alternate or backup port and discards traffic.

Path cost depends on link speed. RSTP uses the 32-bit long path cost method, which distinguishes modern high-speed links that the older 16-bit values could not separate. The table lists the recommended defaults.

Link speedRecommended path costPractical note
100 Mbit/s200,000Legacy access links
1 Gbit/s20,000Common access uplinks
10 Gbit/s2,000Typical distribution uplinks
100 Gbit/s200Core and data center links
1 Tbit/s20Reserved for future speeds
Default RSTP path costs by link speed

Port roles and port states in RSTP

RSTP separates a port’s role, meaning its function in the topology, from its state, meaning whether it forwards frames and learns addresses. This separation is a key reason the protocol converges faster than its predecessor.

The following table describes the five port roles and their purpose.

Port roleFunctionForwards traffic
Root portBest path from a non-root switch to the root bridgeYes
Designated portBest path from a segment toward the root bridgeYes
Alternate portBackup path to the root through another switchNo
Backup portRedundant connection to a segment the switch already servesNo
Disabled portAdministratively or physically downNo
RSTP port roles

RSTP reduces the five classic STP states to three states: discarding, which merges the old disabled, blocking and listening states; learning, in which the port populates the MAC address table but still drops data frames; and forwarding. Fewer states mean fewer timer-driven transitions.

Why RSTP converges faster than classic STP

RSTP converges quickly because it replaces passive timer expiry with active negotiation between neighboring switches. Classic STP waited for the max age timer of 20 seconds and two forward delay periods of 15 seconds each before a port could forward.

Three mechanisms remove most of that waiting. First, an alternate port is precomputed, so when the root port fails it can move to forwarding almost immediately. Second, the proposal and agreement handshake lets a designated port on a point-to-point link move to forwarding as soon as the neighbor confirms it has blocked its own non-edge ports. Third, every switch sends BPDUs as keepalives every 2 seconds, so a neighbor is declared lost after three missed hellos, about 6 seconds, rather than 20.

The comparison below summarizes the main differences between the protocol generations in the switching family.

FeatureSTP (802.1D)RSTP (802.1w)MSTP (802.1s)
Typical convergence30-50 secondsUnder 1 to a few secondsUnder 1 to a few seconds
Port statesFiveThreeThree
Spanning tree instancesOne for all VLANsOne for all VLANsSeveral, each mapped to VLAN groups
Transition methodTimersHandshake and timers as fallbackHandshake and timers as fallback
Load sharing across VLANsNoNoYes
Spanning tree protocol variants compared

RSTP classifies ports by link type to decide when rapid transitions are safe. A full-duplex port is treated as point-to-point and may use the handshake; a half-duplex port is treated as shared and falls back to timers.

An edge port connects to an end device such as a workstation, printer or server and moves to forwarding without delay. It does not generate topology change notifications when it goes up or down. If an edge port ever receives a BPDU, it immediately loses its edge status and participates in the spanning tree normally. Vendors often call this behavior PortFast.

Several companion features harden an RSTP domain against misconfiguration:

  • BPDU guard disables an edge port that receives a BPDU, which stops unauthorized switches from joining.
  • Root guard prevents a port from becoming a root port, protecting the planned root bridge placement.
  • Loop guard keeps a port discarding if BPDUs stop arriving, protecting against unidirectional link failures.
  • BPDU filtering suppresses BPDUs on a port and must be used with great caution, because it can hide real loops.

Design guidance and common mistakes

A stable RSTP domain depends mainly on deliberate root bridge placement and consistent configuration. Leaving every switch at the default priority lets the oldest or lowest MAC address win the election, which may place the root on an access switch and force traffic along inefficient paths.

The table pairs frequent symptoms with their usual causes and remedies.

SymptomLikely causeRecommended fix
Traffic takes a long detourRoot bridge elected by default prioritySet priority 4,096 on the core and 8,192 on a backup
Slow recovery on some linksLink detected as shared or peer runs legacy STPForce point-to-point and migrate peers to RSTP
Frequent MAC table flushingEdge ports not configured on host portsMark host-facing ports as edge ports
Network-wide outage after a desk switch is addedRogue switch with a lower bridge IDEnable BPDU guard and root guard at the access layer
Common RSTP problems and fixes

RSTP remains backward compatible with 802.1D, but a port that hears legacy BPDUs falls back to classic timers on that segment. Large multi-VLAN designs usually adopt MSTP, while very large data center fabrics increasingly avoid spanning tree altogether by using routed links, link aggregation or EVPN overlays.

Explained without jargon

Switches are often connected with spare cables so the network keeps working if one cable fails. The danger is that data can start running in circles around those extra paths and flood the whole network.

RSTP is the rule set switches use to agree on one active route and keep the spares on standby. Its improvement over the older method is speed: when a cable breaks, a spare path takes over in about a second instead of nearly a minute, so most people never notice the failure.

A typical use case

A hospital connects twelve access switches on its wards to two core switches, with each access switch using two uplinks, one to each core. The core switches are given bridge priorities of 4,096 and 8,192, so the first becomes root and the second is the planned backup.

During maintenance, a technician unplugs the primary uplink of the switch serving an intensive care ward. Because the second uplink is already an alternate port, RSTP moves it to forwarding in well under a second. Patient monitors that stream data to the central station lose no more than a few frames.

Under the older Spanning Tree Protocol the same event could have interrupted traffic for 30 seconds or more, enough to trigger alarms at the nursing station. The fast failover is the main reason the hospital standardized on RSTP with BPDU guard on all bedside ports.