STP - determining the blocked port using port ID
When implementing Spanning Tree Protocol (STP), an STP topology will avoid creating a Layer 2 loop by choosing to block certain ports in the topology. When selecting which port to block on a switch, the following four parameters that are found within received BPDUs. Specifically, one BPDU is considered superior to another if it has:
- The lower root bridge ID
- The lower path cost to the root
- The lower sending Bridge ID
- The lower sending port ID
The port receiving the superior BPDU will not be blocked. These parameters are checked in order, and the next is only checked if the previous is a tie.
In the event that the first three are the same, it is the lower sending port ID that is used. This would be needed in the following topology:
So in this case, SW2 will receive BPDUs from the root bridge on both links. Therefore, on both BPDUs, both root bridge IDs are the same, both path costs are the same, and both sending Bridge IDs are the same. The last thing to check is the sending port ID.
Important note: It is the sending port ID that makes the difference. In this case, the port IDs of the ports on SW1.
Fa0/1 on SW2 receives a BPDU with the port ID of Fa0/1 from SW1. Similarly, Fa0/2 on SW2 receives a BPDU with the port ID of Fa0/2 from SW1. The port that receives a BPDU with the lowest port ID is the one chosen to forward traffic. Therefore, the BPDU received on the Fa0/1 interface of SW2 is the superior BPDU, so Fa0/2 is chosen to be blocked.