Spanning Tree Protocol (STP) plays a crucial role in LAN Switching, there are multiple devices are connected with their uplink or downlink devices as a part of Distribution and access layer till Core layer and as we always recommend having redundancy in the network in the form of Link, hardware or power.
During designing of redundant link between devices, there are a chance to create loops and to avoid loops STP is there.
Switching Loops
By default, a switch will forward a broadcast or multicast out all ports, excluding the originating. If a loop created into the network, a highly harmful for the network and can chock the traffic. Sometime it is very difficult to identify and troubleshoot the Layer-2 Loop.
In above example, A PC connected with Switch-3 and send a broadcast packet. Switche-3 will forward that broadcast packer to all his connected ports (SW-1 and Sw-4) except the originated port (where is PC is connected). Switch-1 also forward that broadcast packet to their connected switches (Sw-2) and Sw-4 forward that broadcast packet to their connected switches (Sw-2).
Switch-2 also forward that broadcast packet received from Sw-4 to Sw-1 and packet received from Sw-1 to Sw-4 and this process will continue and will create a loop.
So, how loop can Stop,
- Break the connectivity.
- Powering off the switch
But it is not possible and feasible solution to switch off the switch or break the link as once switch or link will come up, loop can occur again, also switching off our hardware can impact the connectivity and production.
There should be an automatic mechanism which help to block the port to avoid the loop without switching off or removing any link.
What is Spanning Tree Protocol (STP)
Switches requires a mechanism to prevent loops and thus Spanning Tree Protocol (STP, or IEEE 802.1D) was introduced. STP is enabled by default on some switches and some time we need to Enable, its depends on the OEM/vendor make and model.
How STP Works
Once LAN network created and all Switches connected and STP enables and start working then STP creates a topology and then run their algorithm to identify the port where Loop can occur or exists then put that port in Blocking state.
The blocked port can be reactivated if another redundant link on the switch goes down, thus preserving fault-tolerance. Once all switches agree on the topology database, the switches are considered converged.
Types of Spanning Tree
Legacy STP (CST) | PVST | PVST+ | RSTP | RPVST+ | MST | |
Full form/
Stand for |
Common Spanning Tree | Per Vlan Spanning Tree | Per Vlan Spanning Tree | Rapid Spanning Tree | Rapid Per Vlan Spanning Tree | Multiple Spanning Tree |
Defined
by |
802.1D-1998 | Cisco | Cisco | 802.1w, 802.1D-2004 |
Cisco | 802.1s, 802.1Q-2003 |
Instance | 1 | Per Vlan | Per Vlan | 1 | Per Vlan | Configurable |
Trunking Protocol | NO | ISL | 802.1Q, ISL | NO | 802.1Q, ISL | 802.1Q, ISL |
Is Cisco Propriety | Open Standard | Yes | Yes | Open Standard | Yes | Open Standard |
STP IEEE Standards
IEEE | IEEE 802.1w | Introduced RSTP |
IEEE | IEEE 802.1D-2004 | Replaced legacy STP with RSTP |
IEEE | IEEE 802.1s | Introduced MST |
IEEE | IEEE 802.1Q-2003 | Added MST to 802.1Q |
Cisco | PVST | Per-VLAN implementation of legacy STP |
Cisco | PVST+ | Added 802.1Q Trunking to PVST |
Cisco | RPVST+ | Per-VLAN implementation of RSTP
|
What is BPDU
BPDU stand for Bridge Protocol Data Units. BPDU is used to send each other in STP topology to identify if there are any change in topology (TCN) or any loop detected on any port. BPDU sent out all the switches’ ports at evet 2 seconds with specific MAC multicast address: 0180.c200.0000.
BPDU Packet Format.
Field | Bytes | Description |
Protocol Identifier | 2 | Representing a spanning tree protocol. |
Protocol Version Identifier | 1 | Indicating the STP protocol version |
BPDU Type | 1 | Indicates the type of a BPDU[Configuration vs TCN]. |
Flags | 1 | Indicates whether the network topology has changed. |
Root Identifier | 8 | Indicate Current Root Bridge ID |
Root Path Cost | 4 | Indicates the accumulated path cost from a port to the root bridge. |
Bridge Identifier | 8 | Indicates the BID of the bridge, who sends the BPDU. |
Port Identifier | 2 | Indicates the ID of the port that from sends the BPDU. |
Message Age | 2 | Records the time that has elapsed since the original BPDU was generated on the root bridge. |
Max Age | 2 | Indicates the aging time of a BPDU. |
Hello Time, | 2 | Indicates the interval at which BPDUs are sent. |
Forward Delay | 2 | Indicates the period during which a port stays in the Listening and Learning states. |
STP Timers
As we discussed above about in STP there are 5 Ports state from Blocking to Forwarding state. But how much these ports / process takes to come up from Blocking to forwarding.
Although, it depends on the situation and topology, but max time it can take between 30-50 second + 2 second of BPDU = total we can say 30 to 52 seconds.
Let’s understand these timers.
Hello Timer – Default is 2 seconds. BPDU’s are sent by switches.
Forward Delay – Default is 15 seconds. Indicates a delay period in both the listening and learning states of a port. If BPDU is missed to listen at blocking port. Then Blocking ports still wait for 15 sec to convert in listening and another 15 sec from listening to learning.
So, total time of 30 seconds. This delay ensures STP has ample time to detect and eliminate loops.
Max age– Default is 20 seconds. if a switch fails to receive BPDU’s from a neighbouring switch for the Max Age period, it will remove that switch’s information from the STP topology database and send TCN (Topology Change Notification) BPDU for changing ports states.
Visit to our site : https://www.kbrosistechnologies.com/
Watch more Video https://www.youtube.com/channel/UCpcd6IshE1caAbf9EdJd3gw
https://www.youtube.com/channel/UCTbOmLTSlHggEBkt5wFGNRA
FAQ
Q. What is Spanning Tree Protocol (STP)?
A. Spanning Tree Protocol (STP) is a protocol that used in Switches to avoid Loops and its plays a very important role in LAN network to ensuring network stability, preventing loops, and maintaining redundancy in Ethernet networks.
Q. What is use of STP?
A. It helps create a loop-free and efficient network topology while allowing for fault tolerance and backup paths with the mechanism of electing Root bridge, Root Ports, Designated Port and Blocking Port and sense the Loop with sending BPDUs.
Q. What is Root bridge and how its elected?
A. STP elect a Root bridge based on lowest Switch priority or lowest Mac-address. then Root bridge will manage the STP Topology. It has Root Port, Designated port and Blocking Port. with STP, Root that port will be in blocking state where loop can accur. STP has 5 States ( Blocking, Listening, Learning, Forwarding and Disabled).
Q. What is STP Timers?
A. STP timer are:
Hello Timer – Default is 2 seconds. BPDU’s are sent by switches.
Forward Delay – Default is 15 + 15 Second=30 Second for Listening and Learning state
Max Age- Default is 20 seconds