A port ID is a unique STP identifier for a switch port. It combines a port priority with a sequential port number; the default priority is 128. STP uses port IDs to distinguish ports when earlier root-port selection criteria produce a tie. section 14.6
Apply the port ID as the final tiebreaker in root-port selection:
- Compare root cost first; the lowest total path cost toward the root bridge wins. section 14.3.2
- If root costs tie, compare the neighbor bridge IDs and choose the port connected to the neighbor with the lowest BID. section 14.3.2
- If both values tie, compare the neighbor’s port IDs and choose the link connected to the lower port ID. section 14.3.2
- When multiple local ports connect to the same segment, the lowest local port ID can select the root, designated, alternate, or backup role. section 15.2.3
Reading a Cisco port ID
A show spanning-tree entry such as Prio.Nbr 128.1 represents port priority 128 and sequential port number 1, so the port ID is 128.1. Port 128.1 beats port 128.2 when all earlier STP criteria are equal. In one topology, SW1 selects G0/1 because it connects to SW3 G0/0, whose port ID is 128.1; SW3 G0/1 has the higher port ID 128.2. section 14.3.2 section 15.2.3
SW3# show spanning-tree . . . Interface Role Sts Cost Prio.Nbr Type ------------------- ---- --- --------- -------- -------------------------------- Gi0/0 Desg FWD 4 128.1 P2p #1 Gi0/1 Desg FWD 4 128.2 P2p #2 Gi0/2 Desg FWD 4 128.3 P2p #1 SW3 G0/0’s port ID is 128.1. #2 SW3 G0/1’s port ID is 128.2.
Inspect representative show spanning-tree output to connect the Prio.Nbr column with port-ID comparisons. section 14.3.2
