Three Major Problems That Solved by the Spanning Tree Protocol(STP)

Spanning Tree Protocol

Spanning Tree Protocol

The spanning tree protocol is used to avoid looping in a switch. Looping could occur in a switch network at any time due to multiple redundant paths to a destination.

stp, RSTP
Spanning Tree Protocol

Switching loops create three major problems

spanning tree protocol, STP
Major Problems of Switching Loops
  1. Broadcast Storms: A broadcast storm occurs when a switch is overwhelmed by continuous broadcast traffic. When different hosts are transferring/broadcasting data over several links, and the other network devices are re-broadcasting the data back to the multiple links in response, it eventually causes the whole network to go down and lead to a communication failure. It also makes the MAC Table unstable.                                                                                                       
  2. MAC Table Instability: Instability of the MAC table causes a single MAC address to reach multiple ports, wherein, the switch is constantly updating the MAC table.                                                                                                         
  3. Duplicate Frames: If multiple paths have the same destination MAC address, there is a greater possibility that the frame could be duplicated and sent to multiple paths which then create a switch loop.

How does the Spanning Tree Protocol (STP) work?

The Spanning Tree Protocol (STP) is a layer 2 protocol that ensures a loop-free topology for any switched Ethernet in LAN.

Spanning Tree Protocol, STP
Working of A Spanning Tree Protocol

Also Read;

What Are Switching Modes – All you Need to Know About it.

The STP protocol is responsible for identifying active redundant links in the network, it puts forward one of these links in a blocking state. This prevents possible network loops.

 STP operates as follows:

Spanning Tree Protocol enabled switches to require a common point of view of the whole switch network topology. To achieve this, they exchange standardized frame messages called Bridge Protocol Data Unit (BPDU), that are transmitted using layer 2 multicast addresses like 01-80-c2-00-00-00.

Step 1: Electing a Root Bridge.

How does the switch select a root bridge in a simple network?
In every switched network topology, the STP elects one switch as the Root Bridge. Every switch will have 3 Root ID as its MAC address. The lowest MAC address with a Switch Priority’ will become the ‘Root Bridge’, which then acts as the central switch in topology. All other switches are called ‘Non-root Bridge’.The default switch priority is 32,768
The root bridge is identified by the BPDU message. The process is as follows:

1.  The first decision that all switches in a network make is to identify the root bridge.  When a switch is turned on, the spanning-tree algorithm is started to identify the root bridge. BPDU is sent out with the Bridge ID (BID). The Bridge ID (BID) involves a bridge priority that defaults to 32768 and the switch base MAC address.

2. When a switch first starts up, it assumes that it is the root switch and sends BPDUs.

3. These BPDUs contain the BID.

4. All bridges identify the BID and decide that the bridge with the smallest BID value Will be the root bridge.

Spanning Tree Protocol, STP
Function of the Root Bridge

You cannot change the MAC address of a switch. Instead, a network administrator may want to Influence the decision by setting the switch priority to a smaller value than the default value. 
The main function of the root bridge is to broadcast network topology changes to all switches of the network. Whenever the non-root bridge detects a topology change (i.e. a trunk goes down), it sends a topology change notification to the root bridge. The root bridge then broadcasts that topology change out to the other switches.

Port Types

STP assigns different roles for different ports on a switch, depending on factors such as the location of the root and the loops in the topology.
BPDU: Bridge Protocol Data Unit (BPDU) is originally of an 802.1d standard. These are data messages that are exchanged between switches in a Spanning Tree topology (switches Network). BPDU frames contain information about ports, addresses, priorities and costs.

The switch which has the superior BPDU will become the Root Bridge. This prevents looping in a redundant switched network.

Root Ports

The root port on a switch is the only port that has the lowest path cost to the Root Switch.

The path cost is calculated based on the bandwidth of the links. After the switches have elected the root for the network, each connected switch must decide the port it will use to reach to the root. The port which directly connects from Non-root Bridge to Root Bridge is called the Root Port. All other ports are called as the Non-root ports.

spanning Tree Protocol, STP
Root Bridge

The lowest MAC address with priority will be Root Bridge.

100 Mbits/s
1 Gbits/s
2 Gbits/s
10 Gbits/s

The root bridge itself is the root and therefore it does not have any root ports

Designated Port

The Designated Port will be elected and put into the forwarding state. It is based on the Root Path cost. In case of multiple redundant ports having the same root Path cost, the lowest port number will be selected.

Lowest cost link (Path cost) will be elected as the designated port.

Step 2: Port Role Selection

The order of conditions that a switch goes through when deciding its root and designated port is as follows:

1. The port with the lowest root path cost will be the root port or the designated port.

2. If it is tied between multiple ports, the port that connects to the neighbouring switch with the lowest bridge lD becomes the root port or the designated port.

3. If there are multiple connections to that same switch, the port with the lowest received (from the other switch) STP priority will be the root port or the designated port.

4. If it is tied, the port with the lowest received (from the other Switch) hardware number (Fa0/1 is lower than Fa0/2) will be the root port or the designated port.

5. A blocked port: This is the remaining non-designated port which is in the shutdown state. The switch puts certain ports in the blocking state for different reasons.
The main reason is to stop looping which could occur due to multiple ports being connected between switches for redundancy.
Another reason is when port security is enabled on a particular port for security purposes. If any violation of port security occurs in that particular port, it will be put into a blocking state (shutdown).

STP Convergence Time:

STP takes 50 seconds from blocking to the forwarding state.

Spanning Tree Protocol
STP Convergence Time


STP Port States

Blocking: Ports in the blocking state do not forward or receive any frame. The frames will be discarded on arriving at that part and this port will not learn any MAC addresses.  However, the port listens to the BPDU message.
Listening:  The port in the listening state can send and receive the BPDU frames. However, listening ports don’t forward any received frames. They also do not learn any MAC addresses. All Ethernet frames are discarded. The STP calculation of loop-free topology takes place in this state.

Learning: The port in the learning state already identifies its state in the STP domain. It will be learning the MAC addresses from the frames arriving at the port in order to populate the MAC address table. This avoids too much flooding when the port transitions to the forwarding state. However, the port does not forward any Ethernet frames.
Forwarding: The port in the forwarding state will forward all Ethernet traffic as per the switch operation. Also, the port will process all incoming frames and will actively learn MAC addresses from the arriving traffic.

Disabled: This is an administrative shutdown state. The port in this state does not participate in any STP operation.

STP Convergence:

Spanning Tree Protocol takes nearly 50 seconds for its implementation and converging of any topology changes. In simple words, whenever a topology modification takes place in the network (e.g. a link goes down-up), no frame forwarding takes place for till 50 seconds until the STP convergence. This is a lot of inactive time, especially in large networks where topology changes may occur relatively more often.

Leave a Reply

Your email address will not be published. Required fields are marked *