Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Spanning Tree Protocol
Spanning Tree Protocol (STP) is a communication protocol operating at the data link layer of the OSI model to prevent bridge loops and the resulting broadcast storms. It creates a loop-free topology for Ethernet networks.
Working Principle
A bridge loop is created when there are more than one paths between two nodes in a given network. When a message is sent, particularly when a broadcast is done, the bridges repeatedly rebroadcast the same message flooding the network. Since a data link layer frame does not have a time-to-live field in the header, the broadcast frame may loop forever, thus swamping the channels.
Spanning tree protocol creates a spanning tree by disabling all links that form a loop or cycle in the network. This leaves exactly one active path between any two nodes of the network. So when a message is broadcast, there is no way that the same message can be received from an alternate path. The bridges that participate in spanning tree protocol are often called spanning tree bridges.
STP Algorithm Process
To construct a spanning tree, the bridges broadcast their configuration routes. Then they execute a distributed algorithm for finding out the minimal spanning tree in the network, i.e. the spanning tree with minimal cost. The links not included in this tree are disabled but not removed.
In case a particular active link fails, the algorithm is executed again to find the minimal spanning tree without the failed link. The communication continues through the newly formed spanning tree. When a failed link is restored, the algorithm is re-run including the newly restored link.
Key STP Components
| Component | Description |
|---|---|
| Root Bridge | The bridge with the lowest bridge ID becomes the root of the spanning tree |
| Bridge Protocol Data Units (BPDUs) | Control messages exchanged between bridges to share topology information |
| Port States | Blocking, Listening, Learning, Forwarding - states that ports transition through |
| Path Cost | Metric used to determine the best path to the root bridge |
Example
Let us consider a physical topology for an Ethernet network that comprises of six interconnected bridges. The bridges are named {B1, B2, B3, B4, B5, B6} and several nodes are connected to each bridge. The links between two bridges create multiple paths, forming several bridge loops that make the topology susceptible to broadcast storms.
According to spanning tree protocol, links that form a cycle are disabled. This creates a logical topology so that there is exactly one route between any two bridges. The blocked links remain physically connected but are logically disabled to prevent loops.
In the above logical configuration, if a situation arises such that an active link fails, the spanning tree is reconstituted. Previously blocked links may become active to maintain connectivity while preserving the loop-free property.
Conclusion
Spanning Tree Protocol prevents broadcast storms in Ethernet networks by creating a loop-free logical topology. It dynamically blocks redundant links while maintaining connectivity and automatically reconfigures when network changes occur.
