Before we begin with RSTP (Rapid Spanning Tree Protocol), we should take a moment to explain its precursor STP (Spanning Tree Protocol). STP is predominantly used to prevent layer 2 loops and broadcast storms and is also used for network redundancy. Switches within the same network need to be enabled for STP before they run the Spanning Tree Algorithm so they can accurately determine which switch should be elected the “root bridge.” This designated root bridge will be responsible for sending configuration BPDUs (Bridge Protocol Data Units) along with other information to its directly connected switches who, in turn, forward these BPDUs to their neighboring switches. Each switch has a bridge ID priority value (BID), which is a combination of a priority value (default 32768) and the switch’s own MAC address. The switch with the lowest BID will become the Root Bridge.
When switches are first turned on, they will send configuration BPDUs containing their BIDs, with each
switch initially believing themselves to be the root bridge. However, when a switch receives a BPDU with a superior (lower value) BID, that switch will stop originating configuration BPDUs and will instead relay these superior BPDUs to its neighboring switches.
Once a root bridge has finally been announced, a second election process begins to determine the “root port” selection process (the port on a switch that will forward frames to the root bridge). This process will follow the steps below until a root port is elected:
A switch port receives superior BPDUs from another switch and identifies that switch as the root bridge
The port with the lowest root path is selected as the root port if possible
If the path cost is the same, the switch will select the port with the lowest sender BID as the selected root port
If the sender BID is the same (usually the same switch, the port with the lowest physical port number on the sending switch will be selected as the root bridge (as the final tie-breaker)
Election Process Diagram
Let’s follow the process for switch 2 in the diagram below
A switch port receiving superior BPDUs – Ports fa0/1 and fa0/2 receive the same superior BPDU. Therefore, further steps are needed to determine the root port. Port Fa0/3 on switch 2 does not qualify because it’s receiving BPDUs from switch 3.
The port with the lowest root path cost – We can see ports fa0/1 and fa0/2 have equal path costs, so we still have a tie.
The port with the lowest sender BID – Again fa0/1 and fa0/2 have the same BID (that of switch 2) and therefore the final step will be used to determine the root port.
The lowest port number of the sending switch – fa0/1 is lowest port number and is therefore elected the root port for this switch.
The 5 STP states
There are 5 STP switchport states; these are:
|Disabled||The result of an administrative command that will disable the port|
|Blocking||When a device is connected, the port will first enter the blocking state|
|Listening||The switch will listen for and send BPDUs|
|Learning||The switch will receive a superior BPDU, will stop sending its own BPDUs and will relay the superior BPDUs|
|Forwarding||The port is forwarding traffic|
RSTP (Rapid Spanning Tree protocol) is as its name suggests, is a faster transition to a port forwarding state. Unlike STP, which has 5 switchport states, RSTP has only 3: Discarding, Learning and Forwarding. Below is a comparison table:
Alternate and Backup Ports
In RSTP, the blocked port is split into 2 new port roles, Alternate and Backup.
An alternate port receives BPDUs from another switch but remains in a blocked state. For example, let’s say a switch has 2 paths to the Root-bridge, it will elect 1 of the 2 ports as a root port and the other will become an Alternate port. If at any time the Root port fails, this redundant path, the Alternate port will become the new Root port.
A backup port receives BPDUs from its own switch but remains in a blocked state. For example, If a switch has 2 ports connecting to different switches, then 1 port will be elected as a root port and the other port will become the backup port.
RSTP with Meraki Switches
For information on how to configure spanning tree on MS switches, check out our article on Configuring Spanning Tree on Meraki Switches.