About STP (Spanning Tree Protocol) | Part 2
Continuing after Part 1:
Blocking and Forwarding states are stable states. There are two other states: Listening & Learning. These are transitional state.
I have tried to learn the different states in STP by differentiating them by a few things that they do or do not. These things are:
1. Do they send or receive STP BPDUs?
2. Do they learn mac addresses?
3. Do they receive and forward regular traffic?
STP Port States (Summary)
Blocking (Stable)
- BPDU: Send No / Receive Yes
- MAC learning: No
- Forward traffic: No
Listening (Transitional)
- BPDU: Send Yes / Receive Yes
- MAC learning: No
- Forward traffic: No
Learning (Transitional)
- BPDU: Send Yes / Receive Yes
- MAC learning: Yes
- Forward traffic: No
Forwarding (Stable)
- BPDU: Send Yes / Receive Yes
- MAC learning: Yes
- Forward traffic: Yes
Wireshark STP packet capture:
Portfast: Portfast is called a toolkit (optional feature) of STP that solves one problem of STP. As soon as a switch is turned on, it goes through all the steps of for all of it's ports before starting to forward traffic. These steps are: listening and learning. Listening takes 15 seconds and learning takes 15 seconds. Total of 30 seconds before it starts to forward. Same is also true for any port that is connected to an end host. But it is unneccesary because there is no risk of forming a loop on the port which is connected to the end host. The ports that are connected to a switch can only form loops. So to avoid this unneccessary delay on this port which is connected to an end host, portfast is used. If portfast is enabled, it immediately goes to forwarding state without going through listening and learning.
BPDU Guard: BPDU Guard is another optional feature, when BPDU Guard is enabled on a port and if the switch receives a BPDU messages on that port, the switch will block that port. BPDU Guard is usually enabled on ports on which BPDU messages are not supposed to come. For example, ports connected to end devices.
Port Identifier is 0x8001. Here, 8001 is hexadecimal. Hex 80 means 128 in decimal. First two digits means 80 is the port priority. That means port priority of the switchport is 128.
Protocol Version Identifier 0 means classic Spanning Tree, Protocol Version Identifier 2 means Rapid Spanning Tree.
Primary Root Bridge and Secondary Root Bridge: Any switch can be selected as primary root bridge or secondary root bridge.
Command for making a switch primary root bridge is: spanning-tree vlan 1 root primary
Assuming there is only one VLAN, it can be done for multiple VLAN as well. For example, a switch can be primary root bridge for a specific VLAN and be secondary root bridge for another VLAN and not be anything for some other VLAN.
If any switch is selected as primary root, the switch will set the bridge priority to 24576, which is lower than the default priority. Which is basically changing the priority only but using the primary command we do not need to remember the priority values.
Command for making a switch secondary root bridge is: spanning-tree vlan 1 root secondary
This will set the bridge priority to 28672.
Whenever the primary switch fails, the topology has to elect a new root bridge and it will elect the switch that has been set as secondary. It has a priority which is lower than the default priority but higher than the root primary.

Comments
Post a Comment