STP or Spanning Tree Protocol 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.
What is STP Process
- A Root Bridge is elected.
- Root Ports are identified.
- Designated Ports are identified.
- If a loop exists, a port is placed in Blocking If the loop removed the blocked port is activated again.
There is a process that STP follows to avoid the loops. In below diagram, we have found that there is more than one path to reach another device, and this is the perfect example for loop creation.
As we already discuss above that how loop can create, now again take the same scenario, and understand how STP works.
- Electing a Root bridge
- Identifying the Root Ports
- Identifying the Designated Ports
- Blocking Ports
Electing a Root bridge
First step of elect Root Bridge which will act as a centralized and decision maker switch in STP topology.
Now question is how root bridge elected? So, its determine by the switch priority & MAC address. The default Priority is 32,768 and lowest priority wins. If tie between two switches then switch’s lowest MAC address wins.
So, the combination of a switch’s priority and MAC address make up that switch’s Bridge ID.
Bridge ID is root bridge identification.
Switches exchange BPDU for Root bridge selection. Also, its not one time activity, if any new switch added in the topology with lowest mac address or priority then BPDU will share TCN ( Topology change notification) and again selection process will initiated and that new switch will become Root bridge.
In Above topology, Switch-1 will be elected as Root Bridge, because its Mac address is Lowest.
By default, all switch is Root Bridge until selection.
Now second steps to identify Ports.
What is Port status in STP?
There are three types of Ports in STP topology.
- Root Port (RP)
- Designated Port (DP)
- Non-Designated or Blocking Port
Root Port
- Ports which are direct connect with Root bridge or the port which have lowest path cost to reach root bridge.
- Every Switch can have only one Root Port to reach Root Bridge.
- All ports of a Root Bridge are Designated ports.
- Root bridge’s switch ports cannot be Root Ports.
- Ports on the Root Bridge are never placed in a blocking state
- Path Cost is a cumulative cost based on the bandwidth of the links.
Link Bandwidth | Link Cost |
10 Mbps | 100 |
100 Mbps | 19 |
1 Gbps | 4 |
10 Gbps | 2 |
20+ Gbps | 1 |
Designated Port
-
-
- It is also selected based on the lowest lost to reach Root bridge.
- Designated port cannot be gone in blocking state.
- A port can be play both Root and Designated port at the same time.
- Root Bridge all ports always will be Designated port. Neither are Root nor Blocking state.
-
Blocking Port
After selection of all RP and DP, rest of the ports will be in Blocking state and will not send and receive any traffic on that port. The blocked port can be reactivated if another redundant link on the switch goes down, thus preserving fault-tolerance.
To Understand the Basic of Spanning Tree Protocols ( STP) Please visit on https://techblog.kbrosistechnologies.com/stp-spanning-tree-protocol/
Port ID
Some time there are two redundant link or path between Root bridge and another switch and both links have same link cost. (Suppose both are 100 Mbps, so cost will be 19 for both link), in this case how RP will get elected.
The tiebreaker should be the lowest Bridge ID, but this is not applicable in all the cases. Now Port ID will be used as the tiebreaker. Whichever interface has the lowest Port ID will
become the Root Port.
By default, the port priority of an interface is 128, we can reduce the port priority by configuration.
Switch(config)# int fa0/02
Switch(config-if)# spanning-tree port-priority 50
This is the last tiebreaker for identifying the RP. Below are the order to select DP/RP.
-
-
- Lowest Path Cost to the Root Bridge
- Lowest Bridge ID
- Lowest Port ID
-
Below is the example of STP process.
- SW-0 is Root Bridge because all SW have same priority but SW-0 has lowest MAC address.
- Root Bridge both Ports are DP.
- Both SW-1 and Sw-2 fa0/1 are RP as it has lowest path cost to reach Root.
- SW-1 Fa0/2 is Block.
- Sw-2 fa0/2 is DP
SW-0- Root Bridge Spanning Tree output
Sw-1- Spanning Tree output
SW-2- Spanning Tree Output
STP Port States
STP have 5 ports states.
- Blocking
- Listing
- Learning
- Forwarding
- Disabled
- Blocking
This is the default state of any switch port. It will not send or receive any frames or learn Mac-address on this port. But it will keep listen for BPDUs from other switches, to learn about changes to the switching topology like TCN or loop.
- Listing
This port is just listening the BPDU, but switch not put this port in Blocking state. The port will listen for BPDU’s to participate in the election of a Root Bridge, Root Ports, and Designated Ports. Ports in a listening state will not forward frames or learn MAC addresses.
- Learning
After a 15 sec, called a Forward Delay, a port in a listening state will be elected either a Root Port or Designated Port, and placed in a learning state. Ports in a learning state listen for BPDUs and begin to learn MAC addresses. However, ports in a learning state will still not start forward frames.
Also, if a port in a listening state is not kept as a Root or a Designated Port, it will be placed into a blocking state and not a learning state
- Forwarding
After another Forward Delay, a port in learning mode will be placed in forwarding mode. Ports in a forwarding state can send and receive all data frames and continue to build the MAC address table.
- Disabled
A port in disabled state has been administratively shut down and does not participate in STP or forward frames at all.
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 STP Process?
A. Below are Basic STP Process to avoid loops
- Electing a Root bridge
- Identifying the Root Ports
- Identifying the Designated Ports
- Blocking Ports
Q. What is Port status in STP?
A. There are three types of Ports in STP topology.
- Root Port (RP)
- Designated Port (DP)
- Non-Designated or Blocking Port
Q. What is STP Port States
A. STP have 5 ports states.
- Blocking
- Listing
- Learning
- Forwarding
- Disabled