How the tree is built: root bridge, root ports, designated ports

Step 1: elect the root bridge

Every switch has a bridge ID: a priority (default 32768) plus its MAC address. With PVST+, the VLAN number is added to the priority (the system ID extension), so in VLAN 1 the default shows as 32769. The switch with the lowest bridge ID becomes the root bridge: lowest priority wins, and on a tie, the lowest MAC address.

All three switches below have priority 32769, so the lowest MAC wins: SW3.

In NetLab

▶ SW3
SW3>enable
SW3#show spanning-tree vlan 1 | include Root ID|Bridge ID|Address|This
  Root ID    Priority    32769
             Address     001a.423b.6ea3
             This bridge is the root
  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     001a.423b.6ea3

Step 2: every other switch picks one root port

Each non-root switch chooses the port with the lowest root path cost (the sum of the port costs on the way to the root). Ties are broken by the neighbour's bridge ID, then the neighbour's port ID (priority + number).

SpeedCost (short method)
10 Mb/s100
100 Mb/s19
1 Gb/s4
10 Gb/s2

Step 3: every link gets one designated port

On each link, the port closest to the root (lowest root cost, then lowest bridge ID) is designated and forwards. All the root bridge's ports are designated. Any port that is neither root nor designated is blocked (alternate in Rapid PVST+).

In NetLab

▶ SW1
SW1>enable
SW1#show spanning-tree vlan 1

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     001a.423b.6ea3
             Cost        4
             Port        26 (GigabitEthernet0/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     001a.b61f.d605
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1               Altn BLK 4         128.25   P2p 
Gi0/2               Root FWD 4         128.26   P2p 

SW1: root cost 4 via Gi0/2 (straight to SW3). On the SW1–SW2 link both switches are 4 away from the root, so the lower bridge ID wins: SW2's port is designated and SW1's Gi0/1 is the alternate.

Remember: Root bridge: lowest bridge ID. Root port (one per non-root switch): lowest cost to the root. Designated port (one per link): the side closest to the root. Everything else blocks.

HOME LABS COMMUNITY DASHBOARD