STP – Spanning Tree Protocol Explained With Examples
A long time ago, DCE developed the original version of STP (Spanning Tree Protocol). It is called DCE's STP. Later, IEEE developed an open-sourced version of STP. Cisco improved it for its switches. It is called PVST (Per VLAN Spanning Tree). PVST is similar to STP but has some additional features. Both use the same terminology and algorithm.
The main difference between STP and PVST is that PVST runs a separate instance for each VLAN. For example, if a network has five VLANs, PVST will run five instances, whereas STP will run only one. PVST is a Cisco-only feature. It runs only on Cisco switches.
PVST/STP port states
Ports on a PVST/STP switch go through the following five states to reach convergency.
- Disabled
- Blocking
- Listening
- Learning
- Forwarding
Disabled
A disabled port is a port that is administratively disabled for various reasons. A disabled port does not participate in STP or PVST. A port in the disabled state is virtually nonoperational.
Blocking
After excluding disabled ports, the switch sets all remaining ports to the blocking state. In this state, the port does not accept user frames. It accepts only BPDUs. A BPDU is an STP frame. It includes all the information STP/PVST needs to learn and build the network topology.
Listening
In this state, the switch removes the old CAM table entries. Switches use CAM table entries to make forwarding decisions. Each CAM table entry has a default age-out timer. Once this timer expires, the switch removes the entry. The switch uses this state to age out all old entries from the CAM table. In this state, the port only listens to BPDUs. It does not accept and forward user frames.
Learning
In this state, the switch builds the CAM table entries. In this state, the port accepts user frames but does not forward them. From the incoming frames, it learns the MAC addresses of the connected devices. It saves the learned MAC addresses in the CAM table.
Forwarding
In the forwarding state, the switch accepts and forwards user frames.
Electing the root bridge
All STP/PVST running switches elect one switch as the root bridge. After electing the root bridge, they check all network paths. If a switch has more than one path to reach the root path, it chooses only one path to reach the root bridge. Apart from the root bridge, all other switches become non-bridge switches.
STP/PVST port types
There are three STP/PVST port types. These types are root, designated, and disabled. A port can play only one role. A root port connects a non-root bridge to the root bridge. A designated port connects the non-root bridge switch to the local segment. A disabled port does not forward any user frames. It removes loops.
LAB setup
Create a Packet Tracer lab as shown in the following image.

By default, all Cisco switches run STP. You can use the show spanning-tree command in privileged exec mode to verify this. The output of this command organizes information into four sections.
First section
The first section contains two lines. It provides information about the VLAN. As mentioned earlier, Cisco switches run a separate STP instance for each VLAN. If you have more than one VLAN, the output will display information about each VLAN separately. The second line shows the STP variation. If you see IEEE in the output, it indicates the switch is running STP (if it is a non-Cisco switch) or PVST (if it is a Cisco switch).
Second section
The second section contains four lines. It provides information about the root bridge. The first line shows the root bridge switch's priority value. The second line shows the MAC address of the root bridge switch. The third line shows the local switch's role in the topology. On a root bridge switch, it will show that this switch is a root bridge. On a non-root bridge switch, it shows the port number connected to the root switch. The fourth line shows the STP timers.
Third section
The third section also contains four lines. It provides information about the local switch. The first line shows the local switch's priority value. The second line shows the switch's MAC address. On a root bridge switch, the first two lines of the first and second sections will be the same. The third line shows STP timers. The fourth line shows the aging time. The switch uses aging to age out old entries.
Fourth section
The fourth section provides information about the ports' state and their roles in the STP topology.
The following image shows the output of this command on S1.

As shown in the output, there is only one VLAN. The switch is running the PVST variation of STP. It is a root bridge.
The following image shows the output of this command on S2.

As the above output shows, it is a non-root bridge. It is connected to the root bridge on Gigabit 0/1.
The following image shows the output of this command on S3.

As shown in the output above, it is also a non-root bridge. It is connected to the root bridge on Gigabit 0/1. Port 0/1 is disabled to remove the loop.
STP/PVST configuration
PVST is the default STP mode on all Cisco switches. In case you have changed it to RPVST, you can use the spanning-tree mode command to revert it. The following command changes the STP mode to PVST.
Router(config)#spanning-tree mode rapid-pvst

This tutorial is part of the tutorial series "STP, RSTP, PVST, RPVST, and MSTP Explained with Examples". Other parts of this series are the following.
Chapter 01 Introduction and overview of STP and RSTP
Chapter 02 STP, RSTP, PVST, RPVST, and MSTP
Chapter 03 Similarities and Differences between STP and RSTP
Chapter 04 STP and RSTP Terminology
Chapter 05 STP/RSTP Timers Explained
Chapter 06 The Bridge ID and System ID Extension Explained
Chapter 07 PVST/STP Root Bridge Election Process Explained
Chapter 08 STP Port and Path Costs Explained
Chapter 09 STP Port States:- Blocking, Listing, Learning, and Forwarding
Chapter 10 STP - Spanning Tree Protocol Explained With Examples
Chapter 11 RSTP Port States and Types Explained
Chapter 12 PVST/RPVST and EtherChannel Explained
Chapter 13 RSTP / RPVST Explained with Examples
Conclusion
STP/PVST dynamically manages all links. If a link creates a loop, it blocks the port to which it is connected. If a link goes down, the backup link automatically takes over to maintain connectivity.
By ComputerNetworkingNotes Updated on 2026-05-12