L2 · switching · reviewed
RSTP
Rapid Spanning Tree Protocol
Replaces spanning tree’s two timers with an explicit handshake, and names the backup path in advance so failover does not wait for information to expire.
Presenter modeEmbed this figure
Why it exists
Classic spanning tree makes a port wait through listening and learning before it forwards — thirty seconds by default. The delay is not caution about the port; it is caution about the rest of the network, which might not have finished agreeing.
RSTP replaces that wait with a conversation. A bridge proposes, its neighbour blocks anything that could loop and agrees, and the link forwards at once. The safety property is preserved by the neighbour’s guarantee rather than by elapsed time. IEEE 802.1Q-2022 §13.4
It is defined as a modification of spanning tree, not a replacement. The bridge identifier, the priority vector and the comparison order are all unchanged — which is why the two interoperate at all, and why the fallback is so seamless that it goes unnoticed. IEEE 802.1D-2004 §17.4
Asking permission instead of waiting
A new link forwards in milliseconds because the two bridges negotiate. The price is that the downstream bridge has to block everything else first.
A new link comes up between the root and SW1. Under classic spanning tree this port would now spend thirty seconds in listening and learning. Root bridge. SW1: New port discarding. SW2. Host · edge port.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| Root bridge | switch | — |
| SW1 | switch | New port: discarding |
| SW2 | switch | — |
| Host · edge port | host | — |
| Root bridge — SW1 | link | blocking |
| SW1 — SW2 | link | forwarding |
| SW1 — Host · edge port | link | forwarding |
A new link comes up between the root and SW1. Under classic spanning tree this port would now spend thirty seconds in listening and learning.
What changed
- SW1: New port → discarding
- Emphasis: Not forwarding yet
How it works
The proposal and agreement handshake runs only on point-to-point links, which a bridge infers from full duplex. Before agreeing, the downstream bridge syncs: every non-edge designated port goes to discarding, which is its guarantee that nothing behind it can loop. IEEE 802.1D-2004 §17.10
Edge ports are exempt from sync. Declaring host-facing ports as edge is what stops the handshake briefly interrupting every host on the switch each time an uplink changes.
Port roles are named rather than implied. An alternate port is the next-best path to the root and is promoted immediately when the root port fails; a backup port is a second port onto a segment this bridge is already designated for, which on point-to-point media almost always means a cabling mistake. IEEE 802.1D-2004 §17.10
A topology change flushes the filtering database on every port except the one it arrived on, rather than shortening the ageing timer as classic spanning tree does. Faster, and much noisier — which is why an undeclared edge port is expensive.
On the wire
Constructed examples, encoded from the field table below them — not captured traffic.
- IEEE 802.3 MAC frame
- Destination 01:80:C2:00:00:00, the Bridge Group Address. A length field, not an EtherType. IEEE 802.1D-2004
- IEEE 802.2 LLC
- DSAP 0x42, SSAP 0x42, control 0x03 (unnumbered information). IEEE 802.1D-2004
- Bridge Protocol Data Unit
- The fields below, in network byte order. IEEE 802.1D-2004
Configure it
spanning-tree mode rapid-pvstCisco’s rapid mode is per VLAN, so it is RSTP semantics with one instance per VLAN. On a network with many VLANs that is many instances to compute — which is the argument for MSTP rather than for going back to STP.
spanning-tree portfast default spanning-tree portfast bpduguard defaultDeclares every access port an edge port, and shuts any that receives a BPDU. The pair matters: without the guard, edge status is revoked silently the moment something sends a BPDU, and the port quietly becomes slow again.
Common mistake: Enabling portfast without BPDU guard. The failure it is meant to prevent then happens anyway, with no alert and no shut port to point at.
interface GigabitEthernet1/0/10 description hypervisor spanning-tree portfast trunkA trunk to a host — a hypervisor, a server with tagged VLANs — is still an edge port. The `default` above does not cover trunks, which is why a virtualisation host is a common source of topology changes.
spanning-tree loopguard defaultInverts the default response to silence: a port that was receiving BPDUs and stops is held inconsistent rather than promoted to forwarding. On a unidirectional fibre, promotion is a loop.
IEEE 802.1D-2004 §17.10
interface GigabitEthernet1/0/1 spanning-tree link-type point-to-pointOnly needed where duplex misleads the inference. Setting it by hand on a link that is genuinely shared reintroduces the loop the inference was protecting against.
clear spanning-tree detected-protocols interface GigabitEthernet1/0/1Clears the latched STP fallback after a legacy neighbour has been replaced. Without it the port keeps sending version 0 and the slowness outlives its cause.
IEEE 802.1D-2004 §17.4
Verify
show spanning-tree interface Gi1/0/1 detail- Port role, link type, and whether the peer is seen as an STP bridge.
show spanning-tree summary- Which guards are on by default, and the topology change count.
show spanning-tree inconsistentports- Ports loop guard or root guard is holding.
show spanning-tree detail | include changes- Where topology changes are originating.
Caveats
- Portfast without BPDU guard leaves the declaration revocable and silent.
- `portfast default` does not cover trunk ports; a hypervisor uplink needs it stated explicitly.
- The STP compatibility fallback is latched per port and does not clear when the neighbour is replaced.
When it breaks
Symptom first, because that is what you have when it happens.
A link takes thirty seconds to forward on a network that is supposed to be running RSTP.
Narrow it down
- Capture a BPDU on the segment and read the protocol version — 0 is STP, 2 is RSTP.
- Check whether the neighbour runs RSTP at all.
- Look for a port still reporting the peer as an STP bridge after the peer was replaced.
Cause
One end fell back to compatibility mode. A bridge that hears a version 0 BPDU sends version 0 on that port from then on, and the fast handshake is unavailable wherever either end cannot do it.
Fix
Bring the neighbour to RSTP, then force protocol migration — the fallback is per port and latched, so it does not clear itself.
IEEE 802.1D-2004 §17.4A single access port going up or down causes a network-wide burst of flooding.
Narrow it down
- Check the topology change counters and find which port originated the last change.
- Confirm whether that port is configured as an edge port.
- Correlate the flooding with the change rather than with traffic volume.
Cause
A non-edge port generates a topology change when it starts forwarding, and RSTP flushes MAC tables across the network rather than shortening an ageing timer. A laptop unplugging should not be able to do that.
Fix
Configure every host-facing port as an edge port, and pair it with BPDU guard so a switch plugged into one is shut down rather than believed.
Convergence is fast between some switches and slow between others, with no pattern.
Narrow it down
- Check the link type each port has inferred: point-to-point or shared.
- Compare against the duplex setting on those interfaces.
- Look for a hub or a half-duplex link in the slow path.
Cause
The handshake only runs on a point-to-point link, and a bridge infers that from full duplex. A half-duplex link is treated as shared media and falls back to timers.
Fix
Fix the duplex, or set the link type explicitly. Auto-negotiation settling on half duplex degrades far more than spanning tree.
Two bridges keep proposing to each other and the link stays blocked, cycling rather than settling.
Narrow it down
- Watch the proposal and agreement flags in the BPDUs on that link.
- Check whether either side has a stale or duplicated bridge identifier.
- Look for a unidirectional link — one side hearing nothing will keep proposing.
Cause
The handshake needs the downstream bridge to sync and reply. If the reply never arrives — a unidirectional fibre, a duplicate bridge identifier — the upstream keeps proposing and never gets agreement.
Fix
Check the optics and the bridge identifiers, and enable loop guard so a port that stops hearing BPDUs becomes inconsistent rather than deciding it may forward.
A port configured as an edge port starts behaving like a normal one — slow to forward, and generating topology changes.
Narrow it down
- Check whether that port has received a BPDU.
- Look at what is plugged into it — a small switch, a virtualisation host bridging, a phone.
- Confirm whether BPDU guard is configured on it.
Cause
Edge status is a declaration that is revoked the moment a BPDU arrives, because something that sends BPDUs might create a loop. The revocation is correct and it is silent.
Fix
Add BPDU guard so the port is shut down instead of quietly demoted, which turns an invisible degradation into an alert with a port number on it.
Design notes
Declare every host-facing port as an edge port and pair it with BPDU guard. Without the declaration, a laptop being unplugged generates a topology change that flushes MAC tables across the network; without the guard, anything that sends a BPDU can silently revoke the declaration.
Enable loop guard on inter-switch links. RSTP promotes an alternate port as soon as BPDUs stop arriving, which is exactly the wrong response to a unidirectional link — and the speed that makes RSTP good makes this failure faster too.
Fix duplex mismatches before blaming spanning tree. A half-duplex link is inferred to be shared media, the handshake will not run on it, and everything falls back to timers — a symptom far downstream of a negotiation problem.
After replacing a legacy switch, force protocol migration on the ports that faced it. The compatibility fallback is latched per port, so the symptom outlives the cause and gets rediscovered much later by someone with no reason to connect the two. IEEE 802.1D-2004 §17.4
Misconceptions
- “RSTP is a different protocol from STP.”
- It is defined as a modification of it. Port roles, the priority vector and the comparison order are unchanged; what changed is that a port can be granted forwarding by an explicit handshake instead of waiting out two timers, and that the backup path is named in advance. IEEE 802.1D-2004 §17.4
- “RSTP removed the forward delay timer.”
- The timer still exists and still applies wherever the handshake cannot run — a shared-media link, or a neighbour that has fallen back to STP. Fast convergence is the common case, not a guarantee.
- “A topology change in RSTP behaves like one in STP.”
- It is more aggressive. STP shortens the filtering database ageing time; RSTP flushes entries outright on all ports except the one that received the change. That is why an undeclared edge port causes visibly more disruption under RSTP.
- “Alternate and backup are two words for a blocked port.”
- An alternate port is the next-best path to the root and exists on any redundant topology. A backup port is a second port of the same bridge onto one segment, which needs shared media to happen at all — so on a modern network its appearance is a cabling mistake worth investigating. IEEE 802.1D-2004 §17.10
More walkthroughs
Knowing the answer before the questiondesign-choice
Most of RSTP’s speed is not the handshake. It is that the second-best path is already identified, so a failure is a promotion rather than a recalculation.
The access switch has two paths to the root. One port is its root port; the other is named an alternate — a port with a worse path that is deliberately not forwarding. Root bridge. SW1. SW2. Access switch: Root port toward SW1, cost 8, Alternate toward SW2, cost 12.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| Root bridge | switch | — |
| SW1 | switch | — |
| SW2 | switch | — |
| Access switch | switch | Root port: toward SW1, cost 8 · Alternate: toward SW2, cost 12 |
| Root bridge — SW1 | link | forwarding |
| Root bridge — SW2 | link | forwarding |
| SW1 — Access switch | link | forwarding · root port |
| SW2 — Access switch | link | blocking · alternate |
The access switch has two paths to the root. One port is its root port; the other is named an alternate — a port with a worse path that is deliberately not forwarding.
Classic spanning tree has this port too, and calls it blocking. What RSTP adds is the name and the meaning: this is specifically the next-best path to the root, and it is being kept for that purpose.
What changed
- Access switch: Root port → toward SW1, cost 8
- Access switch: Alternate → toward SW2, cost 12
- Emphasis: Ready, not forwarding
Thirty seconds on a network that does not have thirty secondsfailure
One port hears an old BPDU and stops using the handshake — permanently, silently, and only on that link.
A link between two switches takes thirty seconds to forward after a change. Every other link in the building converges instantly. SW1 · RSTP: Converges in 30 s on this port only. Old switch · STP. SW3 · RSTP.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| SW1 · RSTP | switch | Converges in: 30 s on this port only |
| Old switch · STP | switch | — |
| SW3 · RSTP | switch | — |
| SW1 · RSTP — Old switch · STP | link | forwarding |
| Old switch · STP — SW3 · RSTP | link | forwarding |
A link between two switches takes thirty seconds to forward after a change. Every other link in the building converges instantly.
What changed
- Emphasis: 30 s
- SW1 · RSTP: Converges in → 30 s on this port only
Terms
- Root port
- The single port on a non-root bridge with the lowest-cost path to the root. Every non-root bridge has exactly one.
- Designated port
- The one port on each segment that forwards toward the root on that segment’s behalf. Every segment has exactly one.
- Proposal/agreement
- RSTP handshake on a point-to-point designated port. A Proposal bit asks the neighbor to agree; Agreement lets the port skip listening/learning timers.
- Alternate port
- A port with a path to the root that is not the best one, held discarding and ready to be promoted. Naming the backup in advance is where most of RSTP’s speed comes from.
- Edge port
- A port declared to face a host, so it forwards immediately and is skipped by the sync procedure. The declaration is revoked silently the moment a BPDU arrives, which is what BPDU guard turns into an alert.