In this article, we will discuss Spanning Tree Protocol in detail and the different terms associated with STP. STP stands for “Spanning Tree Protocol“. STP is a layer 2 network protocol that is used to prevent loops in the network. A loop in the network could be defined as the state when a network has more than one active path carrying information originating from the same source to the same destination. STP helps to avoid loops in a network.
How does STP work
In simple words, STP monitors all the network links and identifies the redundant connections, and disables the ports which could cause a loop in the network.
States of STP Ports
When STP is enabled on the switch, each port of that switch is set to one of the states mentioned below to control frames.
1. Disabled - In this state, the port does not participate in frame control or STP operations.
2. Forwarding - In this state, the port normally receives and forwards frames. It monitors the
incoming BPDUs indicate if the port has to go to the blocking state.
3. Learning - In this state, the port learns source addresses from received frames and adds them to
the MAC table. Port does not forward frames in this state.
4. Listening - In this state port does not populate the MAC table but it listens to the incoming
BPDUs and awaits new information if it has to go to the blocking state.
5. Blocking - Blocking ports are the ports that may cause a loop in the network. Blocked ports
could still receive BPDU data and it can go to the forwarding state if the STP
algorithm determines.
Modes of STP
Below are the different modes of STP. The first three are IEEE open standard STP modes whereas the last two are Cisco-proprietary STP modes.
IEEE open standard STP modes
1. Classic STP [Spanning Tree Protocol] - It is the first and original IEEE 802.1D STP that
provides a single instance of STP in LAN.
2. RSTP [Rapid Spanning Tree Protocol] - It is an improved version of Classic STP. It is IEEE
802.1w STP and faster for the network to converge, but
only a single instance of STP in LAN.
3. MSTP [Multiple Spanning Tree Protocol] - It is IEEE 802.1s STP and allows to create multiple STP
instances. Also, it allows to map and allocate multiple
VLANs to the instances.
Cisco-proprietary STP modes
1. PVST+ [Per VLAN Spanning Tree Protocol Plus] - It is an improved version of Classic STP and is
the default STP version for Cisco Switches. It
allows to creates one instance of spanning-tree
per VLAN.
2. RPVST+ [Rapid VLAN Spanning Tree Protocol Plus] - It is an improved version of RSTP and network
convergence is faster. It allows to creates one
instance of spanning-tree per VLAN.
Ports Roles
Below are the different ports in the spanning tree topology.
Root Ports - A forwarding port for STP topology is called the root port
Designated Ports - A forwarding port elected for every switch LAN segment is a Designated port.
Alternate Ports - A blocked port providing an alternate path to the root bridge in the STP in
Alternative Port.
Bakcup Ports - A blocked port in a lookback configuration is called a Backup Port.
Root & Designated Switch
There are mainly two types of switches exist in STP topology. Both are mentioned below.
Root Switch - A switch that has all the ports as the designated role is called a root switch.
Designated Switch - A switch that has at least one port as a designated role is called a Designated
switch.
Other important terms of STP
The spanning-tree protocol itself is a very vast topic and it is very difficult to include everything in one article. It will be quite a boring and long article to read. Below are a few important and common terminology that is used in STP and it is important to understand these terms.
Portfast – Portfast immediately brings an interface configured as an access or trunk port to the forwarding state from the blocking state bypassing the listening and learning state. The purpose of portfast is to minimize the time interface must wait for the spanning tree to converge. It is effective if the port is connected to a single host. If portfast is enabled on an interface connecting to another switch can risk looping.
Uplinkfast – If a switch loses connectivity it begins using the alternate path as soon as the spanning tree selects a new root port. By enabling uplinkfast we can accelerate the choice of a new root port when a link or switch fails or when the spanning tree reconfigures itself.
BPDU – Bridge Protocol Data Unit
Switches send and receive spanning-tree frames called BPDU. BPDU contains information about the sending switch and its ports including switch and MAC addresses, switch priority, port priority, and path cost. STP uses the information to elect the root switch and root port for the switched network and the root port and designated port for each switched segment.
BPDU Guard – BPDU Guard feature protects the port from receiving STP BPDUs, however, the port can transmit STP BPDUs. When an STP BPDU is received on a BPDU Guard enabled port, the port is shut down and the state of the port changes to ErrDis (Error-Disable) state. When BPDU guard is enabled on the switch, the spanning tree applies BPDU guard to all PortFast-configured interfaces
BPDU Filter – BPDU filtering allows to avoid of transmitting BPDUs on Portfast-enabled ports that are connected to an end system. When you enable Portfast on the switch, spanning tree places ports in the forwarding state immediately, instead of going through the listening, learning, and forwarding states
Other important topics
- “Couldn’t agree a key exchange algorithm” SSH Error with Putty
- Port-Channel/Channel Group vs Ether Channel/Link Aggregation
- %SW_MATM-4-MACFLAP_NOTIF or MAC Flapping Cisco Switch
- Configure IP SLA on Cisco ASA Firewalls
- Issues Reported in Dec’22 Windows11 Updates: KB5021255 & KB5021234
Source: Knowledge Base, Internet, Cisco
EA00133