What is Spanning Tree Protocol? STP Overview

Spanning Tree Protocol (STP) is a network protocol designed to prevent layer 2 loops. It is standardized as IEEE 802.D protocol. STP blocks some ports on switches with redundant links to prevent broadcast storms and ensure a loop-free logical topology. With STP in place, you can have redundant links between switches in order to provide redundancy.

 

Broadcast Storm

To better understand the importance of STP and how STP prevents broadcast storms on a network with redundant links, consider the following example:

spanning tree protocol

SW1 sends a broadcast frame to SW2 and SW3. Both switches receive the frame and forward the frame out of every port except the port on which the frame was received. So SW2 forwards the frame to SW3. SW3 receives that frame and forwards it to SW1. SW1 then again forwards the frame to SW2! The same thing also happens in the opposite direction. Without STP in place, these frames would loop forever. STP prevents loops by placing one of the switch ports in a blocking state.

 

Loop-Free Topology

With Spanning Tree Protocol (STP), our network topology above would look like this:

 

stp topology blocked port

In the topology above, STP has placed one port on SW3 in the blocking state. That port will no longer process any frames except the STP messages. If SW3 receives a broadcast frame from SW1, it will not forward it out to the port connected to SW2.

STP uses the spanning tree algorithm to prevent loops. The switches among themselves send Bridge Protocol Data Units (BPDU), and a root bridge or root switch will be elected among the switches in the network. This will determine whether a port is a root port, designated port, or blocked port.

The root bridge is the switch with the most preferred bridge ID. The root port is the shortest path forwarding frames to the root bridge, and the designated port sends frames away from the root bridge.

NOTE

Spanning Tree Protocol (STP) enables layer 2 redundancy. In the example above, if the link between SW3 and SW1 fails, STP will converge and unblock the port on SW3.

There are various STP modes, including Rapid Spanning Tree Protocol (RSTP), Multiple Spanning Tree Protocol (MSTP), and VLAN Spanning Tree Protocol.


Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: