If implemented correctly the Spanning Tree Protocol or STP is like your best Friend. Simply put it prevents loops forming at Layer 2 when switches are bridged interconnecting via multiple paths. The key in the last sentence was the term multiple paths. The Spanning Tree Protocol implements the 802.1D IEEE algorithm by exchanging Layer 2 Bridge Protocol Data Units or BPDU messages with other Switches to detect loops, and then removes the loops by shutting down selected bridge interfaces.
The default STP value is 32768, and as a rule of thumb I always set the VLAN priority to 4096 for each VLAN that I’m going to advertise from the Root Bridge. Remember in a Root Bridge election the Bridge (Switch) with the lowest Bridge ID wins the election. For example is you had two Switches with a their default Bridge ID of 32768 + MAC the Switch the the lowest Bridge ID will be elected as the Root Bridge. By setting the VLAN Priority to 4096 for all VLAN I control the election process and the place of the Root Bridge.
Now lets take at the Spanning Tree configuration on Switch SW1, SW2, and SW3.
Lets make sure that our Root Bridge SW1 is the Root Bridge for all normal 1 – 1001 VLANS
SW1#config t SW1(config)#spanning-tree vlan 1-1001 priority 4096 SW1(config)exit SW1#
Lets make sure that Rapid Spanning Tree is running on Switch 1
SW1#config t SW1(config)#spanning-tree mode rapid-pvst SW1(config)#
SW1(config)#interface GigabitEthernet1/0/1 SW1(config-if)#description Trunk to SW2 SW1(config-if)#switchport trunk encapsulation dot1q SW1(config-if)#switchport mode trunk SW1(config-if)#switchport nonegotiate SW1(config-if)#duplex full SW1(config-if)#mls qos trust dscp SW1(config-if)#exit SW1(config)#
SW1(config)#interface GigabitEthernet1/0/2
SW1(config-if)#description Trunk to SW4
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport nonegotiate
SW1(config-if)#duplex full
SW1(config-if)#mls qos trust dscp
SW1(config)#interface GigabitEthernet1/0/3
SW1(config-if)#description Trunk to SW6
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport nonegotiate
SW1(config-if)#duplex full
SW1(config-if)#mls qos trust dscp
SW1(config-if)#exit
SW1(config)#exit
SW1#
SW1#show interface status | include trunk Gi1/0/1 Trunk to SW2 connected trunk full 1000 10/100/1000BaseTX Gi1/0/2 Trunk to SW2 connected trunk full 1000 10/100/1000BaseTX Gi1/0/3 Trunk to SW4 connected trunk full 1000 10/100/1000BaseTX Gi1/0/4 Trunk to SW4 connected trunk full 1000 10/100/1000BaseTX Gi1/0/5 Trunk to SW6 connected trunk full 1000 10/100/1000BaseTX Gi1/0/6 Trunk to SW6 connected trunk full 1000 10/100/1000BaseTX
Lets make sure we running Rapid Spanning Tree on Switch 2
SW2#config t SW2(config)#spanning-tree mode rapid-pvst SW2(config)#
SW2(config)#interface GigabitEthernet1/0/1
SW2(config-if)#description Trunk to SW1
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport nonegotiate
SW2(config-if)#duplex full
SW2(config-if)#mls qos trust dscp
SW2(config)#interface GigabitEthernet1/0/2
SW2(config-if)#description Trunk to SW1
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport nonegotiate
SW2(config-if)#duplex full
SW2(config-if)#mls qos trust dscp
SW2(config-if)#exit
SW2(config)#
SW2(config)#interface GigabitEthernet1/0/3
SW2(config-if)#description Trunk to SW3
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport nonegotiate
SW2(config-if)#duplex full
SW2(config-if)#mls qos trust dscp
SW2(config)#interface GigabitEthernet1/0/4
SW2(config-if)#description Trunk to SW3
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport nonegotiate
SW2(config-if)#duplex full
SW2(config-if)#mls qos trust dscp
SW2#show interface status | include trunk Gi1/0/1 Trunk to SW1 connected trunk full 1000 10/100/1000BaseTX Gi1/0/2 Trunk to SW1 connected trunk full 1000 10/100/1000BaseTX Gi1/0/3 Trunk to SW3 connected trunk full 1000 10/100/1000BaseTX Gi1/0/4 Trunk to SW3 connected trunk full 1000 10/100/1000BaseTX
Lets make sure we running Rapid Spanning Tree on Switch 3
SW3#config t SW3(config)#spanning-tree mode rapid-pvst SW3(config)#
SW3(config)#interface GigabitEthernet1/0/1 SW3(config-if)#description Trunk to SW2 SW3(config-if)#switchport trunk encapsulation dot1q SW3(config-if)#switchport mode trunk SW3(config-if)#switchport nonegotiate SW3(config-if)#duplex full SW3(config-if)#mls qos trust dscp
SW3(config)#interface GigabitEthernet1/0/2
SW3(config-if)#description Trunk to SW2
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
SW3(config-if)#switchport nonegotiate
SW3(config-if)#duplex full
SW3(config-if)#mls qos trust dscp
SW3(config-if)#exit
SW3(config)#exit
SW3#
SW3#show interface status | include trunk Gi1/0/1 Trunk to SW2 connected trunk full 1000 10/100/1000BaseTX Gi1/0/2 Trunk to SW2 connected trunk full 1000 10/100/1000BaseTX
Lets take a look at VLAN 10 on the Root Bridge SW1 with regards to STP
SW1#show spanning-tree vlan 10 VLAN0010 Spanning tree enabled protocol rstp Root ID Priority 4106 Address c471.fe28.e700 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 4106 (priority 4096 sys-id-ext 10) Address c471.fe28.e700 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 sec Interface Role Sts Cost Prio.Nbr Type ------------------- --------- -------- --------- ------------ ------------- Gi1/0/1 Desg FWD 4 128.1 P2p Gi1/0/2 Desg FWD 4 128.3 P2p Gi1/0/3 Desg FWD 19 128.4 P2p Gi1/0/4 Desg FWD 4 128.5 P2p Gi1/0/5 Desg FWD 19 128.6 P2p Gi1/0/6 Desg FWD 4 128.9 P2p Gi1/0/7 Desg FWD 4 128.10 P2p Gi1/0/11 Desg FWD 4 128.11 P2p Gi1/0/12 Desg FWD 4 128.12 P2p Gi1/0/13 Desg FWD 4 128.13 P2p Gi1/0/14 Desg FWD 4 128.14 P2p Gi1/0/17 Desg FWD 4 128.17 P2p Edge Gi1/0/18 Desg FWD 4 128.18 P2p Edge Gi1/0/20 Desg FWD 4 128.20 P2p Edge Gi1/0/21 Desg FWD 4 128.21 P2p Gi1/0/22 Desg FWD 19 128.22 P2p Gi1/0/24 Desg FWD 19 128.24 P2p
SW1#show spanning-tree root Root Hello Max Fwd Vlan Root ID Cost Time Age Dly Root Port ---------------- -------------------------- ------------- -------- ------- --------------- VLAN0001 4097 c471.fe28.e700 0 2 20 15 VLAN0003 4099 c471.fe28.e700 0 2 20 15 VLAN0010 4106 c471.fe28.e700 0 2 20 15 VLAN0011 4107 c471.fe28.e700 0 2 20 15 VLAN0019 4115 c471.fe28.e700 0 2 20 15 VLAN0020 4116 c471.fe28.e700 0 2 20 15 VLAN0025 4121 c471.fe28.e700 0 2 20 15 VLAN0055 4151 c471.fe28.e700 0 2 20 15 VLAN0060 4156 c471.fe28.e700 0 2 20 15 VLAN0070 4166 c471.fe28.e700 0 2 20 15 VLAN0080 4176 c471.fe28.e700 0 2 20 15 VLAN0090 4186 c471.fe28.e700 0 2 20 15 VLAN0099 4195 c471.fe28.e700 0 2 20 15 VLAN0110 4206 c471.fe28.e700 0 2 20 15 VLAN0119 4215 c471.fe28.e700 0 2 20 15 VLAN0120 4216 c471.fe28.e700 0 2 20 15 VLAN0170 4266 c471.fe28.e700 0 2 20 15 VLAN0180 4276 c471.fe28.e700 0 2 20 15
I hope that you found this post on Spanning Tree helpful and informative. Be sure to let me know what you think by leaving your suggestions, and feedback in the comments section below. You can find out more about these and other articles be checking out recent posts and archives. To learn more about myself be sure to check out the About page. And as always thanks again for visiting The Packet.