As previously stated, troubleshooting STP can be a very complex task. Because STP loops can bring down an entire network, it is important to understand exactly what is happening and quickly implement an appropriate solution, as in most cases, all you might have is nothing more than a few minutes. There are two primary reasons that result in STP protocol failure or issues. These are configuration errors and the loss of STP BDPUs. Additional causes also include MAC address table corruption, hardware and software issues and bugs, as well as switch resource utilization issues.
Designing and Implementing a Sound STP Network
There are several elements that should be taken into consideration when designing a solid STP network. These elements include the following:
- Determine the Location of the Root Bridge
- Design a Deterministic Topology
- Integrate Layer 3 Switching
- Avoid End-to-End VLAN Solutions
The root bridge is the crux of an STP network. The root is responsible for generating Spanning Tree Protocol Configuration BPDUs which are propagated throughout the domain to other downstream switches. The root bridge sends out Hello packets every Hello interval, which defaults to 2 (two) seconds. If the root bridge fails, Configuration BPDUs will no longer be sent. In this case, switches will wait for the expiration of the Max Age time before invaliding stored BPDUs and beginning the process of electing a new root bridge. Network connectivity is restored after the new root bridge has been elected.
There is no explicit configuration required to facilitate root bridge election when running STP. However, it is recommended practice to explicitly select a device which should be elected root bridge, and ensure that this is well documented so that this information is available when troubleshooting any STP issues. In addition to this, allowing STP to elect a root bridge could also result in poor performance for some network segments as illustrated in Figure 3-4:
Fig. 3-4. Suboptimal Forwarding Due To Root Bridge Placement
Referencing Figure 3-4, assuming the switches in the network all have the same priority value, which would be 32,768 by default; STP would use the lowest MAC to elect the root bridge. Following this logic, the switch with MAC address 0000.0000.0001 would be elected as the root. The result is that user traffic from the other switches in the network will have to traverse that switch to reach network resources, such as servers, as illustrated by the arrows in Figure 3-4.
Depending on the capabilities of this switch, e.g. bandwidth and processing capabilities, there would most likely be performance issues, such as slow response, on the network for users connected to the other switches accessing network resources. In this network, the recommended solution would be to configure the switch with MAC address 0000.0000.0002 as the root bridge. This provides an optimum path for network user traffic that is destined to any network resources, e.g. network servers and printers, as is illustrated in by the arrows in Figure 3-5:
Fig. 3-5. Optimal Forwarding Due To Root Bridge Placement
There are two supported methods of influencing root bridge election. The first method entails manually specifying the bridge priority using the spanning-tree vlan [number] priority [value] global configuration command. Valid priority values can be configured beginning from 0 and incrementing in value of 4096 thereafter; e.g. 0, 4096, 8192…61,440.
The second method entails using a built-in macro available in Cisco IOS software. This macro is invoked using the spanning-tree root [vlan] [primary|secondary] global configuration command. When this command is executed using the [primary] keyword, Cisco IOS software checks the switch priority of the current root switch for the specified VLAN.
Because of the extended system ID support, the switch sets the switch priority for the specified VLAN to 24,576 if this value will cause this switch to become the Root for the specified VLAN. However, if the Root Switch for the specified VLAN has a priority lower than 24,576, the switch sets its own priority for the specified VLAN to 4096 less than the lowest switch priority. This continues until the switch has a lower priority than the current Root and is itself elected Root.
When using the macro, the switch will become the root bridge only for the specified VLAN. It is also important to remember that this command runs only once. In other words, if after executing this command the switch becomes the root bridge for that VLAN, should another switch be configured with a priority value lower than that selected by the macro, that other switch will become the root bridge instead. The macro will need to be reissued in order to influence the root bridge election process again. For this reason, it is recommended that you manually specify the root bridge using the manual bridge priority configuration method.
In addition to determining the location of the root bridge, it is also important to ensure that the traffic flows in the LAN are deterministic, meaning that they are not randomly determined. This entails knowing which ports should be placed into a forwarding state and which ports will be in a blocking state, when the root bridge is active and even when the secondary (backup) root bridge is active, if applicable. As stated in chapter 1, traffic flows should be included in the network documentation. Understanding the path traffic should take during normal and backup scenarios simplifies the troubleshooting process.
Consideration should also be given to the number of redundant links included in the topology. While redundancy allows for high availability, too much redundancy can cause you more problems than it resolves. Remember, all it takes for a Spanning Tree loop to be created, which typically results in a network meltdown, is for a single blocking port to mistakenly transition into the forwarding state. The greater the number of redundant network links, the greater the number of ports that STP will place into the blocking state and ultimately, the higher the chances of a Spanning Tree loop developing in the network. Avoid over-redundant solutions.
Layer 3 switching solutions, such as Cisco Express Forwarding allow for the routing of traffic at switching speeds. The different switching mechanisms supported in Cisco IOS software are described in additional detail in the following chapter. Routing allows for inter-VLAN communication. In addition to this, routers break up broadcast and collision domain. Layer 3 switching provides the following advantages over Layer 3 routing:
- Hardware-based packet forwarding
- High-performance packet switching
- High-speed scalability
- Low latency
- Lower per-port cost
- Flow accounting
- Security
- Quality of service (QoS)
When designing and implementing switched LAN solutions, consider a design that uses local VLANs over end-to-end VLANs. End-to-end VLANs are VLANs that span the entire switch fabric of a network. These VLANs are also commonly referred to as campus-wide VLANs, as they sometimes span the entire campus LAN so that network hosts and their servers remain in the same VLAN (logically), even though the devices may physically reside in different buildings, for example. End-to-end VLAN implementation is based on the 80/20 rule and therefore requires that each VLAN exist at the access layer in every switch block. The primary reason for end-to-end VLAN implementation is to support maximum flexibility and the mobility of end devices. These solutions have the following characteristics:
- They allow the grouping of users into a single VLAN independent of physical location
- They are difficult to implement and troubleshoot
- Each VLAN provides common security and resource requirements for members
- They becomes extremely complex to maintain as the campus network grows
Unlike end-to-end VLANs, local VLANs are based on geographic locations by demarcation at a hierarchical boundary. These VLANs are designed for modern-day networks that adhere to the 80/20 rule, where end users typically require greater access to resources outside of their local VLAN. With local VLANs, up to 80% of the traffic is destined to the Internet or other remote network locations while no more than 20% of the traffic remains local.
Despite the name, local VLANs are not restricted to a single switch and can range in size from a single switch in a wiring closet to an entire building. This VLAN implementation method provides maximum availability by using multiple paths to destinations, maximum scalability by keeping the VLAN within a switch block, and maximum manageability.
Common Causes for Bridging Loops
While a solid design should minimize STP failures, it cannot guarantee that problems or issues will not arise within the network. When STP fails, a bridging loop often ensues. A loop originates when a port that should be blocking transitions to the forwarding state. Given that there is no concept similar to the Layer 3 TTL at Layer 2, when this happens, frames can traverse the network endlessly consuming switch resources and possibly leading to a complete network meltdown. There are multiple reasons a bridging loop can occur. Common reasons include, but are not limited to, the following:
- Physical layer connectivity issues
- Switch misconfigurations
- Switch resource utilization issues
- Broadcast storms
- Hardware or software errors
A loss of connectivity between switches results in a loss of BPDUs. If a switch does not receive BPDUs on a port on which they should be received, it transitions other ports into the forwarding state, which can result in a Spanning Tree loop if the root port link is not actually down. Such problems are typically caused by duplex mismatches for Ethernet trunk links and unidirectional links when using Fiber trunk links.
Duplex mismatches are applicable only when using 10/100 links. As stated previously, Catalyst switches support only full duplex for 1Gbps links. Given that this is the standard implemented in most modern networks, duplex mismatches are typically a non-issue. However, because 10/100 links can be used for trunk connectivity, it is still worth keeping this in mind in the event that you are using 10/100 Ethernet links for trunking between switches in your network. Figure 3-6 illustrates how a simple duplex mismatch could cause a bridging loop:
Fig. 3-6. Bridging Loop Formation Due To Duplex Mismatches
Figure 3-6 illustrates a basic switched network. The relevant port states, i.e. forwarding (F) and blocking (B) are illustrated based on the location of the root bridge. Assume, for example, that auto negotiation fails between the root bridge and Switch # 4, resulting in the root bridge defaulting to half-duplex operation while Switch # 4 defaults to full-duplex for this link. Half-duplex Ethernet uses a carrier sensing mechanism (CSMA/CD) on the physical medium to determine when gaps between frame transmissions occur. Stations may begin transmitting any time they detect that the network is quiet.
When a collision occurs, a jam signal is sent out and the devices involved in the collision stop transmitting for a short period of time. A random back-off algorithm is then executed to ensure the devices are transmitting at random times, to ensure that they avoid another collision or collisions. Given this, if Switch # 4 is transmitting enough traffic, it is possible that the current root bridge (half-duplex) might defer all packets, including BPDUs, until it senses that the medium is available. Should this happen, Switch # 4 might not receive BPDUs on its root port within the 20 second timeframe and from an STP point-of-view, assume that it has lost its connection to the root bridge, and thus bring up the backup port currently in the blocking state. Once this port is unblocked, a bridging loop is created.
Unlike Ethernet, Fiber Optic links do not use CSMA/CD. However, transceiver issues can cause unidirectional communication issues between two switches which can result in the same problem described with Half-Duplex Ethernet connection. When using Fiber for trunk links between switches, it is recommended that UDLD be enabled. UDLD can detect improper cabling or unidirectional links at Layer 2 and automatically break resulting loops by disabling some ports. By default, when UDLD is enabled on Cisco Catalyst switches, it will only be enabled for Fiber Optic links. However, UDLD can also be manually enabled for Ethernet links.
Another common configuration error that results in STP protocol failure or bridging loops is the configuration of aggressive timers. As stated earlier in this chapter, the default STP timers are based on an STP network diameter of 7 bridges or switches. The default timer values are listed and described below in Table 3-3:
| Timer | Default | Description |
|---|---|---|
| Hello Time | 2 seconds | Specifies the time between sending Spanning Tree BPDUs |
| Max Age | 20 seconds | Specifies the maximum time to save BPDU information |
| Forward Delay | 15 seconds | Specifies the time spent in the Listening and Learning states |
Cisco IOS software provides two methods of changing the default STP timers, which may be used to decrease the convergence time of the switched network. The first method entails manually specifying the individual timers, on a per-VLAN basis, using the spanning-tree vlan [vlan] [forward-time | hello-time | max-age] <interval> global configuration command on the root bridge. The second option includes using a macro which can be enabled using thespanning-tree vlan [vlan] root [primary | secondary] diameter <2-7> global configuration command on either the root or backup root bridge. When the macro is used, Cisco IOS software will automatically set the most optimum STP timers for the specified network diameter.
While aggressive timers do allow for faster convergence, they can also make troubleshooting the network much more difficult, especially during periods of instability where the topology constantly fluctuates. For this reason, do not arbitrarily adjust STP timers without valid justification or a recommendation for the TAC. Instead, consider alternatives, such as RSTP which do speed up convergence without having to manipulate timers.
And finally, another common configuration error that results in loops is PortFast configuration. PortFast is a Cisco STP enhancement that, when enabled, allows the specified port to skip the first stages of the STA and directly transition to the forwarding state. PortFast can be enabled on both trunk and access links. A common reason for configuring or enabling PortFast on an access port is if a user complains that they are unable to get an IP address from the DHCP server, which is most likely due to a timeout because of the amount of time it takes for an STP port to transition to the forwarding state. In such cases, PortFast can be used to resolve this issue.
A common misconception with PortFast is that because the trunk keyword can be specified in conjunction with the spanning-tree portfast interface configuration command, enabling PortFast on a trunk link will also decrease convergence. This is not true because PortFast does not disable Spanning Tree on the selected port, and this can result in bridging loops. Thespanning-tree portfast trunk interface configuration command should only be used on trunk links that are connected to devices such as servers or firewalls that do not send BPDUs but do support multiple VLANs.
Another common reason for bridging loops is high switch resource utilization. This primarily includes CPU and memory consumption, but could also be due to congestion. High CPU utilization may be due to a plethora or reasons. Additionally, the factors that contribute to this will vary depending on the switch platform. While Catalyst switches always service control packets, such as BPDUs, before normal packets, such as ICMP packets, for example, overutilization of the CPU can result in the switch running out of resources to transit control packets such as BPDUs. Again, this can lead to a bridging loop. There are several Cisco IOS commands that can be used to check system health and troubleshoot high resource utilization issues, with the most common command being the show processes command. Additional performance troubleshooting commands are described in detail in the following chapter.
A Broadcast storm means that your network is overwhelmed with a constant flow of Broadcast or multicast traffic. Broadcast storms can eventually lead to a complete loss of network connectivity as the packets proliferate. While uncommon in the high-bandwidth LANs of today, it is quite possible for one or more devices, e.g. a powerful server, to bring down the network because of Broadcasts. A high volume of Broadcast traffic consumes bandwidth and can result in packet loss, including the loss of BPDUs, leading to a bridging loop.
A more common cause for Broadcast storms in modern day networks is Multicast. IP Multicast uses packets that include IP Options, such as Internet Group Messaging Protocol (IGMP) packets used in multicast implementations. These exception packets are punted to the CPU of the switch for processing. A large number of these packets can increase CPU utilization, depleting the resources the switch has to process and transmit control packets such as BPDUs.
Broadcast storms can be mitigated by enabling the traffic suppression feature under applicable interfaces using the storm-control [broadcast | multicast | unicast] level <percent | pps>interface configuration command. In addition to this, high-end switches such as the Catalyst 6500 series also support the rate-limiting (throttling) of packets that are punted to the CPU, allowing for additional protection against such events. These options are described in additional detail in the following chapter.
And finally, both hardware and software errors can also result in bridging loops. For example, faulty hardware, such as a bad port, may result in data (packet) corruption or a high rate of errors on the link, which may cause BPDUs to be lost, ultimately resulting in ports that should be blocking transitioning to a forwarding state and causing a loop. Although uncommon, software bugs can also cause STP protocol failures, which result in bridging loops. Because a bug is difficult to identify, you should contact the TAC if you suspect a software bug.
Troubleshooting Spanning Tree
In the previous section, we discussed some of the reasons that can cause STP to fail and result in the development of bridging loops in the network. Unlike routing loops wherein packets are discarded after the TTL decrements to 0 (zero), bridging loops can result in frames traversing the network infinitely. As this happens, more and more switch resources are consumed resulting in the switch finally ‘locking up’. In such situations, in-band access, such as Telnet and SSH, to the switch is typically lost and only out-of-band management via the Console is possible. For this reason, as was stated earlier in this chapter, it is important to ensure that the network is well designed and documented. This allows you to identify the following:
- The overall topology of the network
- The location of the root bridge
- Redundant links and blocking ports
This information allows you to effectively troubleshoot the bridging loop. Because a number of problems could cause a bridging loop, there is no single method that can be used to troubleshoot such issues. However, by understanding the common causes of bridging loops, you can use a process of elimination to isolate, and ultimately resolve, the issue. As previously stated, a bridging loop will most likely result in you losing in-band access to the switch, meaning that only out-of-band access and management via the Console will be possible. If you know the location of the root bridge, during periods of extended instability the first thing you should do to reduce STP BPDU traffic is to increase STP timers, i.e. the Forward Delay and Maximum Age (Max Age) to the maximum possible values. This allows you to somewhat stabilize the network and continue troubleshooting the bridging loop. Following this, you can perform the following activities to identify and isolate the issue:
- Check Port Utilization Statistics
- Check Port BPDU Statistics
- Check for Duplex Mismatches
- Check Port Errors
- Check Resource Utilization
The best way to identify a bridging loop is to capture the traffic on a saturated link and check that you see similar packets multiple times. An interface with traffic overload can fail to transmit vital BPDUs. A link overload also indicates a possible bridging loop. You can use the show interfaces command to verify link utilization statistics per port.
In addition to verifying utilization statistics, you should also verify that the ports that should be receiving BPDUs are receiving them. BPDUs should be received on root ports and on blocked ports (those on blocked ports are inferior). You can use the show spanning-tree interface [name] detail command to verify BPDU statistics on a per interface basis. You can also use theshow spanning-tree vlan [number] detail command to view interface statistics on a per-VLAN basis.
When using these commands, you should see more received BPDUs on a root port that is in the forwarding state than BPDUs sent because BPDUs are propagated downstream from the root bridge throughout the STP domain. Because all ports send BPDUs when they initialize, you should see a few BPDUs sent out of the root port. Following is the output of the show spanning-tree interface [name] detail command for a port elected as the root port:
| Cat-3550-1#show spanning-tree interface fastethernet 0/11 detail Port 11 (FastEthernet0/11) of VLAN0001 is root forwarding Port path cost 19, Port priority 128, Port Identifier 128.11. Designated root has priority 32769, address 000b.fd67.6500 Designated bridge has priority 32769, address 000b.fd67.6500 Designated port id is 128.11, designated path cost 0 Timers: message age 2, forward delay 0, hold 0 Number of transitions to forwarding state: 1 Link type is point-to-point by default BPDU: sent 6, received 69600 |
Notice the significant difference between the number of send and received BPDUs. This is what you should expect to see during normal STP operation. On blocking ports, should also see a large number of BPDUs received, which too is normal. While you will see some sent BPDUs, which is also normal, this number should not be incrementing during normal STP operation. Additionally, you can also look at the number of transitions to the forwarding state to troubleshoot instability issues. Following is the output of the show spanning-tree interface [name] detail command for a port that has been placed into the blocking state:
| Cat-3550-1#show spanning-tree interface fastethernet 0/12 detail Port 12 (FastEthernet0/12) of VLAN0001 is alternate blocking Port path cost 19, Port priority 128, Port Identifier 128.12. Designated root has priority 32778, address 000b.fd67.6500 Designated bridge has priority 32778, address 000b.fd67.6500 Designated port id is 128.12, designated path cost 0 Timers: message age 2, forward delay 0, hold 0 Number of transitions to forwarding state: 0 Link type is point-to-point by default BPDU: sent 3, received 42804 |
And finally, on the root bridge itself, you should expect to see more BPDUs transmitted than are received on all ports. This indicates normal STP operation. Following is the output of the show spanning-tree vlan [number] detail command on the root of the specified VLAN:
| Cat-3550-2#show spanning-tree vlan 10 detailVLAN0010 is executing the ieee compatible Spanning Tree protocol Bridge Identifier has priority 32768, sysid 10, address 000b.fd67.6500 Configured hello time 2, max age 20, forward delay 15 We are the root of the spanning tree Topology change flag not set, detected flag not set Number of topology changes 4 last change occurred 23:27:07 ago Times: hold 1, topology change 35, notification 2 hello 2, max age 20, forward delay 15 Timers: hello 1, topology change 0, notification 0, aging 300Port 11 (FastEthernet0/11) of VLAN0010 is designated forwarding Port path cost 19, Port priority 128, Port Identifier 128.11. Designated root has priority 32778, address 000b.fd67.6500 Designated bridge has priority 32778, address 000b.fd67.6500 Designated port id is 128.11, designated path cost 0 Timers: message age 0, forward delay 0, hold 0 Number of transitions to forwarding state: 1 Link type is point-to-point by default BPDU: sent 43024, received 3Port 12 (FastEthernet0/12) of VLAN0010 is designated forwarding Port path cost 19, Port priority 128, Port Identifier 128.12. Designated root has priority 32778, address 000b.fd67.6500 Designated bridge has priority 32778, address 000b.fd67.6500 Designated port id is 128.12, designated path cost 0 Timers: message age 0, forward delay 0, hold 0 Number of transitions to forwarding state: 1 Link type is point-to-point by default BPDU: sent 43025, received 3 |
In addition to using show commands, you can also enable BPDU debugging using the debug spanning-tree bpdu command to verify BPDU statistics. However, keep in mind that the switch CPU will most likely already be very high and enabling debugging might just lock up the switch. The following shows a sample of the output that is printed by this command:
| Cat-3550-1#debug spanning-tree bpdu*Mar 2 15:12:27.770: STP: Data 00000000008028000BFD676500000000008028000BFD676500800B0000140002000F00 *Mar 2 15:12:27.774: STP: VLAN0040 Fa0/11:0000 00 00 00 8028000BFD676500 00000000 8028000BFD676500 800B 0000 1400 0200 0F00 *Mar 2 15:12:27.774: STP(40) port Fa0/11 supersedes 0 *Mar 2 15:12:27.774: STP: VLAN0040 rx BPDU: config protocol = ieee, packet from FastEthernet0/12 , linktype IEEE_SPANNING , enctype 2, encsize 17 *Mar 2 15:12:27.774: STP: enc 01 80 C2 00 00 00 00 0B FD 67 65 0C 00 26 42 42 03 *Mar 2 15:12:27.774: STP: Data 00000000008028000BFD676500000000008028000BFD676500800C0000140002000F00 *Mar 2 15:12:27.774: STP: VLAN0040 Fa0/12:0000 00 00 00 8028000BFD676500 00000000 8028000BFD676500 800C 0000 1400 0200 0F00 *Mar 2 15:12:27.778: STP(40) port Fa0/12 supersedes 0 *Mar 2 15:12:27.778: STP: VLAN0020 rx BPDU: config protocol = ieee, packet from FastEthernet0/11 , linktype IEEE_SPANNING , enctype 2, encsize 17[Truncated Output] |
As previously stated, duplex mismatches can result in both VLAN connectivity as well as STP protocol failures. When the switch notices duplex mismatches, it will print the following:
%CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on FastEthernet0/1 (not full duplex), with R2 FastEthernet0/0 (full duplex)
Interface or port errors could also be used to identify the root cause of the bridging loop. Using the show interfaces command, check for incrementing errors which could indicate packet corruption. Depending on the switch platform, you could also use additional commands such as the show controllers ethernet-controller [interface] command or the show interfaces counters errors [interface] commands to view error statistics.
And finally, also include resource utilization checks in your troubleshooting. As was previously stated, high CPU utilization can be caused by a number of things. If possible, attempt to determine which process is causing the high CPU utilization using the show processes CPU command. Because this command prints a lot of information, you should filter the output to increase the efficiency of your troubleshooting process. For example, you could filter the output of this command such that all process using no CPU resources are omitted as follows:
| Cat-3550-1#show processes cpu | exclude 0.00 CPU utilization for five seconds: 0%/0%; one minute: 0%; five minutes: 0% PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process 51 581000 423131 1373 0.39% 0.39% 0.39% 0 Vegas Statistics 71 708 730 969 0.15% 0.04% 0.01% 0 Exec |


