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 speed | Recommended path cost | Practical note |
|---|---|---|
| 100 Mbit/s | 200,000 | Legacy access links |
| 1 Gbit/s | 20,000 | Common access uplinks |
| 10 Gbit/s | 2,000 | Typical distribution uplinks |
| 100 Gbit/s | 200 | Core and data center links |
| 1 Tbit/s | 20 | Reserved for future speeds |
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 role | Function | Forwards traffic |
|---|---|---|
| Root port | Best path from a non-root switch to the root bridge | Yes |
| Designated port | Best path from a segment toward the root bridge | Yes |
| Alternate port | Backup path to the root through another switch | No |
| Backup port | Redundant connection to a segment the switch already serves | No |
| Disabled port | Administratively or physically down | No |
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.
| Feature | STP (802.1D) | RSTP (802.1w) | MSTP (802.1s) |
|---|---|---|---|
| Typical convergence | 30-50 seconds | Under 1 to a few seconds | Under 1 to a few seconds |
| Port states | Five | Three | Three |
| Spanning tree instances | One for all VLANs | One for all VLANs | Several, each mapped to VLAN groups |
| Transition method | Timers | Handshake and timers as fallback | Handshake and timers as fallback |
| Load sharing across VLANs | No | No | Yes |
Edge ports, link types and protective features
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.
| Symptom | Likely cause | Recommended fix |
|---|---|---|
| Traffic takes a long detour | Root bridge elected by default priority | Set priority 4,096 on the core and 8,192 on a backup |
| Slow recovery on some links | Link detected as shared or peer runs legacy STP | Force point-to-point and migrate peers to RSTP |
| Frequent MAC table flushing | Edge ports not configured on host ports | Mark host-facing ports as edge ports |
| Network-wide outage after a desk switch is added | Rogue switch with a lower bridge ID | Enable BPDU guard and root guard at the access layer |
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.