STP how to find the root bridge
In order to find the root bridge in an STP topology, you can issue the show spanning-tree
command, and this will show you the MAC address of the root bridge for each VLAN configured on the switch. You’ll get something like this:
SW2#show spanning-tree vlan 10 VLAN0010 Spanning tree enabled protocol ieee Root ID Priority 24586 Address 5254.001a.935a Cost 4 Port 1 (GigabitEthernet0/0) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 28682 (priority 28672 sys-id-ext 10) Address 5254.0015.bc74 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 sec Interface Role Sts Cost Prio.Nbr Type ------------------- ---- --- --------- -------- -------------------------------- Gi0/0 Root FWD 4 128.1 P2p Gi0/1 Desg FWD 4 128.2 P2p
From the above output, you can see that for VLAN 10, the root bridge has an address of 5254.001a.935a
. You also know which is the root port.
Now if you know nothing else about your network , it may be hard to find that particular switch. What you can do is take a look at the cost to the root bridge, and this will give you an idea of how far away it is. In this case, the cost is 4. For more info on how to interpret these costs, take a look at STP Cost Calculation Methods.
Once you know the cost and the root port from the output, you can determine how far away the root bridge is, and via what path you can get there. You can trace your way back, from switch to switch, until you reach it. If you have no other information, that would be the way to find the root bridge.