Network Topology
A network consisting of four switches (LSW1, LSW2, LSW3, LSW4) connected in a loop to demonstrate STP convergence.
Device Configuration
LSW1 (Intended Root Bridge)
[Device] stp mode stp
[Device] stp priority 0
LSW2
[Device] stp mode stp
[Device] stp priority 4096
LSW3
[Device] stp mode stp
LSW4
[Device] stp mode stp
STP Operation Logic
1. Root Bridge Selection
Upon enabling STP, switches transmit Configuration BPDUs. The device with the lowest Bridge ID (Priority + MAC Adress) is elected as the Root Bridge. Since LSW1 has the priority set to 0, it becomes the root. This can be verified with the following output:
CIST Bridge :0 .4c1f-cc11-6984
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .4c1f-cc11-6984 / 0
CIST RegRoot/IRPC :0 .4c1f-cc11-6984 / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :15
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 2h:2m:26s
Number of TC :15
Last TC occurred :GigabitEthernet0/0/2
2. Root Port (RP) Election on Non-Root Bridges
Each non-root switch selects one Root Port, which is the port with the lowest Root Path Cost (RPC) to the Root Bridge. The RPC is the cumulative cost of all incoming interfaces along the path to the root.
- LSW2: Port GE0/0/1 has an RPC of 20000, GE0/0/2 has 40000, and GE0/0/3 has 60000. Therefore, GE0/0/1 is elected as the RP.
- LSW4: If multiple paths have the same RPC, the Port ID (PID) is used as a tie-breaker.
LSW2 GE0/0/1 -> Root Port
LSW3 GE0/0/1 -> Root Port
LSW4 GE0/0/1 -> Root Port (Due to lower PID)
3. Designated Port (DP) Election
After RPs are selected, switches exchange BPDUs on their remaining segments. The port on the segment that advertises the best BPDU (lowest Root ID, then lowest RPC, then lowest Sender BID) becomes the Designated Port. All ports on the Root Bridge are Designated Ports.
LSW1: GE0/0/1, GE0/0/2 are DPs
LSW2: GE0/0/2 is a DP (LSW2's BID is better than LSW3's on that segment)
LSW3: GE0/0/3 is a DP (Lower RPC compared to LSW4 on that segment)
4. Alternate Port Election
Any port that is neither a Root Port nor a Designated Port is placed in a blocking state to prevent loops. These are identified as Alternate Ports.
LSW4: GE0/0/2 -> Alternate Port (Blocked)