Skip to main content

 

Cisco Meraki Documentation

Spanning Tree Protocol (STP) Overview

Spanning tree protocol (STP) (IEEE 802.1D) is predominantly used to prevent layer 2 loops and broadcast storms and is also used for network redundancy. It was developed around the time where recovery from an outage that took upwards of a minute or more was acceptable. Throughout the years, as technology improved and critical applications relied on stable connections, businesses moved away from these long recovery times and looked for faster solutions.

STP evolved into rapid spanning tree protocol (RSTP) (802.1w), which offers several improvements over STP (802.1D). It has new port states and port roles and, more importantly, faster convergence times. Both STP or RSTP are critical to having a healthy network and an administrator would benefit from using RSTP over STP. RSTP is the answer for businesses that require faster recovery times.

This document provides an overview of the STP and RSTP standards. You will learn about the following:

  • How the STP election process works
  • STP port states and port roles
  • RSTP election process
  • RSTP port states and port roles

Learn more with this free online training course on the Meraki Learning Hub:

Sign in with your Cisco SSO or create a free account to start training.

STP

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 bridge protocol data units (BPDUs) along with other information to its directly connected switches that, in turn, forward the 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.

STP Port States

There are five 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.

STP Port Roles

  • Root - Ports on non-root switches with the best cost path to root bridge. These ports forward data to the root bridge.
  • Designated - Ports on root and designated switches. All ports on the root bridge will be designated.
  • Blocked - All other ports to bridges or switches are in a blocked state. Access ports going to workstations or PCs are not affected.

STP Election Process

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:

  1. A switch port receives superior BPDUs from another switch and identifies that switch as the root bridge.

  2. The port with the lowest root path is selected as the root port, if possible.

  3. If the path cost is the same, the switch will select the port with the lowest sender BID as the selected root port.

  4. 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 Diagrams

Single Switches

Let’s follow the process for Switch 2 in the diagram below.

election_process_diagram.jpeg

  1. A switch port receiving superior BPDUs. Port 1 and 2 receive the same superior BPDU from Switch 1, therefore, further steps are needed to determine the root port. Port 3 on Switch 2 does not qualify because it’s receiving BPDUs from Switch 3.

  2. The port with the lowest root path cost. We can see Port 1 and 2 have equal path costs, so we still have a tie.

  3. The port with the lowest sender BID. Again, Port 1 and 2 have the same BID (that of Switch 1), and therefore the final step will be used to determine the root port.

  4. The lowest port number of the sending switch. Port 1 of Switch 2 is connected to the lowest port number on Switch 1 (Port 1) and is therefore elected the root port for Switch 2.

Stacked Switches (MS Classic)

The outcome of the STP Election Process can be a little different when utilizing Stacking Technology. Let's follow the process for Switch 2 again below, but with the following in consideration:

  • A switch stack utilizes one logical control plane
  • A Meraki switch stack will utilize a generated chassis MAC address (e.g. 00:18:0A:4F:XX:XX) that is unique to a Meraki Organization
  • A Meraki switch stack will converge and deterministically elect an Active Switch on boot
  • Switch Stack Port IDs will increment starting with the Active switch.

election_process_stack.png

  1. A switch port receiving superior BPDUs. Port 1 and 2 receive the same superior BPDU from Switch 1, therefore, further steps are needed to determine the root port. 

  2. The port with the lowest root path cost. We can see Port 1 and 2 have equal path costs, so we still have a tie.

  3. The port with the lowest sender BID. Again, Port 1 and 2 have the same BID (that of Switch 1), and therefore the final step will be used to determine the root port.

  4. The lowest port number of the sending switch. Port 1 of Switch 2 is connected to Port 1 of the Member switch and Port 2 is connected to Port 1 of the Active switch. As we understand that the Active switch will send Port IDs lower than that of the Member switch in its BPDUs, Port 2 of Switch 2 is elected root port.

Topology Change Notification (TCN) can trigger the STP election process. When a switch detects a change in the network topology, such as a trunk port transitioning to the forwarding state or going up or down, it sends a TCN to the root bridge. The root bridge then acknowledges the TCN, prompting all switches to update their MAC address tables and recalculate the best path to the root bridge.

Stacked Switches (MS390/Catalyst)

For MS390/Catalyst switches, the outcome of the Stack Election process does not influence how Switch Stack Port IDs are incremented. As such, a Member switch may send BPDU's with a lower Port ID to that of the Active Switch. It is not unexpected to see ports connected to a Member switch to therefore be elected root port if reaching the 4th tiebreaker.

Rapid Spanning Tree Protocol (RSTP)

Rapid spanning tree protocol (RSTP) is as its name suggests, a faster transition to a port-forwarding state. Unlike STP, which has five switchport states, RSTP has only three: discarding, learning, and forwarding.

RSTP Port States

  • Disabled - The result of an administrative command that will disable the port.
  • Discarding - When a device is connected, the port will first enter the discarding state.
  • 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 Port Roles

  • Root - Ports on non-root switches with best cost path to root bridge. These ports forward data to the root bridge.
  • Designated - Ports on root and designated switches. All ports on the root bridge will be designated.
  • Alternate - Receives BPDUs from another switch but remains in a blocked state. 
  • Backup - Receives BPDUs from its own switch but remains in a blocked state. You are not likely to see this in a production environment unless hubs are used.

Alternate and Backup Ports

In RSTP, the election process is the same as STP, except the blocked port is split into two new port roles: alternate and backup.

Alternate

An alternate port receives BPDUs from another switch but remains in a blocked state. For example, let’s say a switch has two paths to the root bridge. It will elect one of the two 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.

Backup

A backup port receives BPDUs from its own switch but remains in a blocked state. For example, If a switch has two ports connecting to different switches, then one port will be elected as a root port and the other will become the backup port.

RSTP_election_diagram.jpeg

Comparing STP and RSTP Port States

Below is a comparison table between STP and RSTP.

STP RSTP
Blocking Discarding
Listening Discarding
Learning Learning
Forwarding Forwarding

 

 

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.

  • Was this article helpful?