The configuration of spanning tree is pretty simple unless you want to change your timers or add multiple spanning tree instances; then it can get complex. The timers and more advanced configurations are covered in Chapter 5.
STP is enabled on all Cisco switches by default. However, you might want to change your spanning tree configuration to have many spanning tree instances. This means that each VLAN can be its own spanning tree. This is known as Per-VLAN spanning tree.
To enable or disable spanning tree on a set-based switch, use the set spantree parameter command. This is performed on a VLAN-by-VLAN basis rather than a port-by-port configuration:
Terry_4000> (enable) set spantree disable 1-1005 Spantrees 1-1005 disabled. Terry_4000> (enable) set spantree enable 1-1005 Spantrees 1-1005 enabled.
The preceding configuration shows the disabling of spanning tree on an individual VLAN basis. To enable spanning tree on an individual VLAN basis, use set spantree enable VLAN(s). Cisco recommends that you do not disable spanning tree on a switch, particularly on uplinks where a loop can occur.
On switches that have a CPU usage indicator, this is sometimes also called “the spanning tree loop indicator.” It’s relatively rare to see the CPU usage indicator get much past 20 percent utilization for more than a few seconds at a time. If network connectivity has been lost and you suspect a spanning tree loop is the culprit, take a look at the CPU usage indicator. If utilization reaches 70 percent or higher, when the switch never sees that level of usage during normal operation, that’s a good indicator of a spanning tree loop.
Spanning Tree is enabled by default on modern switches, but you can enable or disable the protocol as needed. To enable or disable spanning tree on an IOS-based switch, use the spanning-tree vlan vlan_number command or the no spanning-tree vlan vlan_number command. Use the show spanning-tree command to view the spanning tree status. The following configuration shows how to enable and disable spanning tree on a 2950 switch:
Terry_2950#conf t Terry_2950(config)#no spanning-tree vlan 1 Terry_2950(config)#^Z Terry_2950#show spanning-tree No spanning tree instances exist. Terry_2950#conf t Terry_2950(config)#spanning-tree vlan 1 Terry_2950(config)#^Z Terry_2950#show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 0 Address 00b0.6414.1180 Cost 100 Port 1 (FastEthernet0/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 000b.be53.2c00 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 Interface Port ID Designated Port ID Name Prio.Nbr Cost Sts Cost Bridge ID Prio.Nbr ------------ -------- ---- --------- --- --------- -------------------- Fa0/1 128.1 100 LIS 0 0 00b0.6414.1180 128.1 Fa0/24 128.24 100 LIS 100 32769 000b.be53.2c00 128.24 Terry_2950#
Notice that the commands include mandatory references to the VLANs. You will remember that all ports are in VLAN 1 by default. In the next chapter we will be considering the use of different spanning trees for each VLAN, and these commands will make a little more sense then. In the meantime, just trust me and accept that the Cisco ISO demands that you enter a VLAN number at this time.
To see the spanning tree configuration and whether it is active on a Catalyst 4000 set-based switch, use the show spantree command as shown here:
Terry_4000> (enable) show spantree VLAN 1 Spanning tree enabled Spanning tree type ieee Designated Root 00-e0-34-88-fc-00 Designated Root Priority 32768 Designated Root Cost 0 Designated Root Port 1/0 Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec Bridge ID MAC ADDR 00-e0-34-88-fc-00 Bridge ID Priority 32768 Bridge Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec Port Vlan Port-State Cost Priority Fast-Start Group-Method ----- ---- ---------- --- -------- ------------- ----- 1/1 1 forwarding 19 32 disabled 1/2 1 not-connected 19 32 disabled 2/1 1 not-connected 100 32 disabled 2/2 1 not-connected 100 32 disabled 2/3 1 not-connected 100 32 disabled 2/4 1 not-connected 100 32 disabled 2/5 1 not-connected 100 32 disabled <Output truncated>
By default, the show spantree command provides information about VLAN 1. You can gather spanning tree information about other VLANs by using the show spantree vlan# command.
The show spantree command provides you the following information:
Designated root The MAC address of the root bridge.
Designated root priority The priority of the root bridge. All bridges have a default of 32768.
Designated root cost The cost of the shortest path to the root bridge.
Designated root port The port that is chosen as the lowest cost to the root bridge.
Root timers The timers received from the root bridge.
Bridge ID MAC address This bridge’s ID. This plus the bridge priority make up the bridge ID.
Bridge ID priority The priority set; the preceding bridge output is using the default of 32768.
Bridge timers The timers used by this bridge.
Ports in the spanning tree Not all available ports are displayed in the preceding output. However, this field does show all ports participating in this spanning tree. It also shows whether they are forwarding.
Although the command abbreviation show span works on all the switches, you will get much different output if you use it on the 4000 series. This is because a SPAN (Switch Port ANalyzer) is the port used to connect to a sniffer. On the 4000, abbreviate spantree to no less than spant to avoid this.