STP – Spanning Tree Protocol Explained

What is STP?

STP is a link management protocol designed to support redundant links that stops switching loops in the STP network. It is a Layer 2 protocol that runs on bridges and switches, which should be enabled on the switch interfaces. IEEE standardized STP protocols as IEE 802.1D. The full form of STP is Spanning Tree Protocol.

Why do we need STP?

Here is some situation when Spanning Tree Protocol is important:

  • The reliability (fault tolerance) of the network is increase exponentially by the introduction of redundancy.
  • Switches flood traffic out all ports, when the traffic needs to be sent to a destination that is not yet known.
  • Broadcast and multicast traffic is forwarded out to every port, apart from the port on which the traffic arrived.
  • The Spanning-Tree Protocol is used to create a loop-free logical topology from a physical topology that has loops.

How STP works? Example

Spanning trees use an algorithm to search for the redundant links in the LAN and select the best paths. It is mainly used to put all links in either forwarding or blocking.

After this process, all the links without a redundant link is likely to be in the forwarding state. The redundant links that were not as good as the selected links would be blocking. Spanning Tree never uses multiple links to the same destination. There is no load-sharing feature with Spanning Tree.

Types of STP

Here, are different types of Spanning Tree Protocols:

Standard Description Abbreviation
IEEE 802. 1D. Loop Prevention
Auto-reconfig of tree in case of any changes
Slow convergence (up to 50 bps)
IEEE 802. 1w Rapid Spanning Tree Protocol

  • Improved STP with fasterconvergence
  • Backward compatible with STP
IEEE 802. 1Q Virtual LAN
Defining 1 common spanning tree for all VLANs
Per VLAN Spanning Tree

  • 1STP instance per VLAN
  • PVST + is an improved variant of PVST
Per VLAN Rapid Spanning Tree PVRST+ orR-PVST+
IEEE 802.1s Multiple Spanning Tree protocol
Multiple instances of VLAN mapped to 1 STP.

Criteria for Spanning Tree

The three criteria for Spanning Tree loop helps to decide that interface are of the forwarding state are:

  • All interfaces on the root bridgeshould be put in a forwarding state.
  • For other bridges that are not the root bridge, the port which is closest to the root bridge is put in a forwarding state.
  • The bridge with the lowest admin distance to the root bridge is known as the designated bridge.

Stage of STP Protocol

Four stages of Spanning-Tree Port states are:

Stages of STP
Stages of STP

Blocking State

Block state is a non-designated port, and it is never participating in frame forwarding. Its time limit is 20 sec or unlimited. An interface always enters the blocking state when you enable STP.

Listening State

The listening state is the first state. It is an interface that is entered after the blocking state. The interface helps you to determine that the interface that should participate in frame forwarding.

The listening state performs the following functions:

  • Discards frames received on the port
  • Does not learn addresses
  • Receives BPDUs

Learning State

Learning state helps to prepare for participating in frame forwarding. The interface allows us to enter the learning state from the listening slate.

Learning state performs the following functions:

  • Discards frames received on the port
  • Receives BPDUs
  • Learns addresses

Forwarding State

An interface in the forwarding state form the forward frames. This interface enters the forwarding state from the learning state which performs the following functions:

  • Receives and forwards frames which is received on the port
  • Learns addresses
  • Receives BPDUs

Disabled State

This state does not participate in the Spanning Tree loop because the port is administratively disabled, and its timing is also unlimited.

A disabled interface performs the following functions:

  • Discards frames received on the port
  • Does not learn addresses
  • Does not receive BPDUs

Important terms used in Spanning Tree Protocol

Here are some important terms used


Bridge is an important component of VTP, which connects two or more LAN segments.

Root Bridge (RB)

It is the bridge that offers an interconnection point for all segments. All the bridges in a LAN have a path to the root. STP allows you to select the root bridge automatically. However, if the STP network admin wants, he or she can change the RB according to the network.

Non-Root Bridge (NRB)

A noon-root Bridge is any bridge that is not the root bridge.

Root Port (RP)

The root port is a port that leads towards the Root Bridge.

Designated Port (DP):

Every LAN segment has 1 Designated Port. Every bridge also receives the frames from DP and forwards them through its RP towards the Root Bridge.

Port ID:

The port ID helps you to decide the root port. It consists of a configurable 1-byte priority value and a unique port number of each bridge.

Path Cost (PC):

Path Cost, which is also known called PC, helps to decide the best topology with regard to forwarding speed. STP uses the concept of Path Cost.

Designated Ports

A designated port is a disabled port, and it is blocked by a network admin. This port can’t send a packet to another switch. It is also not a populated MAC address on the MAC table.

Non-Designated Ports

A non-Designated port is a switch port that is blocked. It is also known as a blocked port, or sometimes an alternate port. It cannot forward packets to the next switch. It also does not populate the MAC address in the MAC table.


Rapid Spanning Tree Protocol (RSTP) is a network protocol that ensures a loop-free topology for Ethernet networks.

Bridge Protocol Data Units (BPDU)

The Spanning Tree Protocol requires a STP network device to exchange messages to help from a loop-free logic topology. These messages are called BPDUS ( Bridge Protocol Data Units). Each network device sends BPDUs, which helps to exchange topology information.

BPDUS helps switches to do the following:

  • Select a single switch which will act as the root of the spanning tree
  • BPDUS also helps to calculate the shortest path from itself to the root switch, which is designated one of the switches as the closest to one to the Root for each LAN segment.
  • Select one of its ports as a root port (if it is a no switch)
  • Pickup the port that are part of the spanning tree algorithm called designated ports.
  • Blocks the non-designated ports.

Configuration BPDU

It is a unique bridge ID of the root device in the network topology. It acts as a bridge ID of the transmitting bridge, an identifier of the transmitting port.

Topology Change Notification (TCN) BPDU

One network device is selected as the root bridge. The shortest distance to the root bridge should be calculated for each network device based on the path cost.

A designated bridge for every LAN segment is selected. This is also the network device closest to the root bridge, so it should be forwarded to the root. This is the port that provides the best path from the bridge to any root bridge.

Differences between STP and RSTP

In STP, the bridge only sends out a BPDU when reviewed on their RP (root protocol) from RB (the root bridge). RSTP enable the switch to send out BPDU in every hello time.
STP includes two port types: Root Port and Designated Port RSTP method includes additional port, Alternate Port ,and Backup Ports.


STP Protocol is defined as a link management protocol designed to support redundant links that stops switching loops in the STP network.

State Description Process BPDUs Learn MAC
Inti Initialization of a port. NO NO
Disabled Administrative state which doesn’t participate in STP standard operations. NO No
Blocking The port doesn’t forward Ethernet frames. Yes (receive and process only BPDUS) No
Listening Computation of loop-free topology is carried out in this STP state. The port is assigned its role. Yes (Send and received BPDUS) NO
Learning It is an additional state to delay Ethernet frames’ forwarding, which helps you avoid flooding the network. Yes Yes (popular MAC address table)
Forwarding Normal operation of forwarding Ethernet frames. Yes Yes