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 Diagram

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

RSTP1.png

  1. 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.

  2. 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.

  3. 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.

  4. The lowest port number of the sending switch. fa0/1 is the lowest port number and is therefore elected the root port for this switch.

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.

RSTP2.png

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?