Spanning Tree Protocol – STP Explained.

By | December 2, 2023

What is the Spanning Tree Protocol (STP)?

STP is used by switches to prevent loops from occurring on a network, this process is implemented by using the spanning tree algorithm to disable unwanted links and blocking ports that could cause a loop.

Here are the key points about STP:

Purpose: In a network with multiple paths between switches, STP prevents loops by selectively blocking some paths, ensuring there is only one active path between two network devices at any time. Loops in a network can lead to serious problems like broadcast storms and database instability.

How STP Works : STP works by electing a root bridge (the primary reference point) and then calculating the shortest path from each switch to this root bridge. Non-essential paths are put into a blocking state, preventing loops.

Bridge Protocol Data Units (BPDUs): STP uses BPDUs to exchange information between switches. These packets contain information about the sending switch’s ID, the root bridge ID, and the path cost to the root bridge.

Root Bridge Election: The root bridge in an STP network is selected based on the lowest bridge ID, which is a combination of a priority value and the switch’s MAC address.

Path Selection: Each switch determines the best path to the root bridge based on the sum of the path costs of the links along the route. The link with the lowest cost becomes the root port.

Port States:

Blocking: The port is inactive and does not participate in frame forwarding.
Listening: The port listens for BPDUs and determines whether it can move to the next state.
Learning: The port learns MAC addresses but doesn’t forward frames yet.
Forwarding: The port sends and receives all data frames.
Disabled: The port doesn’t participate in STP.


STP Versions: There are several versions of STP, including the original IEEE 802.1D standard, Rapid Spanning Tree Protocol (RSTP, IEEE 802.1w), and Multiple Spanning Tree Protocol (MSTP, IEEE 802.1s).

Loops and duplicate frames can have severe consequences on a network. Most LANs are designed to provide redundancy so that if a particular link fails another one can take over the forwarding of frame across the LAN.

Each switch port on a network detects the MAC address of a host or PC A, it then sends messages to other switches on the network to inform them of its knowledge on how to get to PC A. The problem starts when another switch discovers the same host or PC A’s MAC address, In time every switch on the network will start flooding messages on the network of their discovery and how to get to the same PC A and a loop has formed.

STP Standards / Types

STP Operation in Detail:

Spanning Tree Protocol ensures that there is only one logical path between all destinations on the network by intentionally blocking redundant paths that could cause a loop.

When a switch port detects a loop in the network, it blocks (A port is considered blocked when network traffic is prevented from entering or leaving that port) one or more redundant paths to prevent a loop from forming.

To stop a loop from forming, STP chooses one switch to be ‘Root Bridge’ on the network. The other switches select one of its ports as the ‘Root Port’ then, a ‘designated port’ is chosen on each segment and all other ports are closed down.

STP Outline of Process

Spanning Tree Protocol

Cisco switches run STP by default, no configuration is needed.

STP continually monitors the network for failures, be it switch ports or changes in the network topology. STP acts quickly in making redundant ports available if there is a failure on a link.

Summary:

Spanning Tree Protocol

* Used by switches to turn a redundant topology into a spanning tree.

*  Disables unwanted links by blocking ports

*  Is defined by IEEE 802.1d

*  Switches run STP by default – configuration needed.

*  Choose one switch to be Root Bridge

*  Choose a Root Port on each other switch

*  Choose a Designated Port on each segment

*  Intentionally closes down all other ports

RELATED POSTS

How the Root bridge and Ports are chosen Inter-VLAN routing Explained

Understanding STP and EtherChannel VLAN Trunking Protocol (VTP)

IPv6 Explained EIGRPv6 RIPv6 or RIPng OSPFv3