RSTP is designed to converge in under 3 seconds, a stark contrast to its predecessor, which could take 30-50 seconds.
Let’s watch RSTP in action. Imagine a simple network with three switches: SW1, SW2, and SW3, connected in a triangle. SW1 is the root bridge.
SW1 (Root Bridge):
interface GigabitEthernet0/1
description Link to SW2
spanning-tree rapid
spanning-tree portfast
spanning-tree guard root
!
interface GigabitEthernet0/2
description Link to SW3
spanning-tree rapid
spanning-tree portfast
spanning-tree guard root
!
spanning-tree mode rapid
spanning-tree vlan 1 priority 0
SW2:
interface GigabitEthernet0/1
description Link to SW1
spanning-tree rapid
spanning-tree portfast
!
interface GigabitEthernet0/2
description Link to SW3
spanning-tree rapid
spanning-tree portfast
!
spanning-tree mode rapid
SW3:
interface GigabitEthernet0/1
description Link to SW1
spanning-tree rapid
spanning-tree portfast
!
interface GigabitEthernet0/2
description Link to SW2
spanning-tree rapid
spanning-tree portfast
!
spanning-tree mode rapid
Initially, all ports might be forwarding. However, RSTP quickly identifies redundant paths. On SW2, the link to SW3 will become a Designated Port, forwarding traffic. The link from SW2 back to SW1 (the root) will also be a Designated Port. On SW3, the link to SW2 becomes a Designated Port, and the link to SW1 becomes a Designated Port.
Now, consider the link between SW2 and SW3. Both SW2 and SW3 will initially try to make their port facing each other a Designated Port because they both see SW1 as the root. However, RSTP has a rapid negotiation process. The switch that receives a superior BPDU on its Designated Port (meaning a BPDU from a switch that is closer to the root, or has a lower bridge ID if distances are equal) will block its other port towards the redundant link.
In our example, SW2 and SW3 will exchange BPDUs. Let’s say SW2’s bridge ID is lower than SW3’s. SW2 will send a superior BPDU to SW3 on their shared link. SW3 will then transition its port connected to SW2 from Designated to Root Port. SW2, receiving a BPDU from SW1 (the root) on its port towards SW1, and a BPDU from SW3 on its port towards SW3, will designate its port towards SW1 as Root Port and its port towards SW3 as Designated Port. SW3 will see its port towards SW1 as Root Port and its port towards SW2 as Designated Port. This leaves one link in a blocking state to prevent loops. RSTP’s agreement mechanism on the shared link between SW2 and SW3 will quickly determine that one port must transition to a discarding state.
The core problem RSTP solves is preventing Layer 2 loops in redundant switched networks while dramatically improving convergence times compared to STP. It achieves this by introducing new port roles (Root, Designated, Alternate, Backup) and states (Discarding, Learning, Forwarding), and by using a proposal-agreement handshake for rapid transition of ports to the Forwarding state.
Here’s how the port roles work:
- Root Port: The port on a non-root bridge that has the lowest path cost to the root bridge. There’s only one Root Port per switch.
- Designated Port: The port on a segment that has the lowest path cost to the root bridge. Every segment (link between two switches or switch and end device) has exactly one Designated Port.
- Alternate Port: A port that provides an alternate path to the root bridge, but is currently blocked because a Root Port on the same switch offers a better path. This port can quickly transition to a Root Port if the primary Root Port fails.
- Backup Port: A port that provides a backup path to a segment where another port on the same switch is already the Designated Port. This is less common and typically occurs with hubs or misconfigurations.
The states are simpler:
- Discarding: The port is not forwarding frames and not learning MAC addresses. This is the equivalent of STP’s Blocking, Listening, and Disabled states combined.
- Learning: The port is not forwarding frames but is learning MAC addresses.
- Forwarding: The port is forwarding frames and learning MAC addresses.
The magic of RSTP’s speed lies in its proposal-agreement mechanism. When a link comes up, the switches involved don’t wait for STP’s timers. Instead, a switch that believes it should be the Designated Port on a segment sends a "Proposal" BPDU to its neighbor. If the neighbor agrees (meaning it can also achieve a better path to the root through the proposing switch), it will block all its non-edge ports and send back an "Agreement" BPDU. Upon receiving the Agreement, the proposing switch immediately transitions its port to Forwarding. This handshake happens very quickly.
A key insight is that RSTP treats all links between switches as potentially redundant. It actively negotiates roles and states on every link. Unlike STP’s passive blocking, RSTP’s Alternate and Backup ports are ready to take over almost instantly. The spanning-tree guard root command on edge ports connected to end devices is crucial. If a switch receives a superior BPDU on a port configured with guard root, it will err-disable that port, preventing a rogue switch from becoming the root bridge and disrupting the network.
The most surprising aspect for many is how RSTP handles topology changes. Instead of flooding Topology Change Notifications (TCNs) up to the root and then back down, RSTP directly informs its neighbors about the change and immediately starts the re-convergence process on affected links. A switch detects a link failure and immediately transitions its alternate port for that segment to a Root Port and its other port to Designated, if applicable, without waiting for the root to be notified.
The next concept you’ll encounter is the impact of different link types and configurations on RSTP’s behavior, particularly regarding edge ports and point-to-point links.