Useful STP Display Commands

Useful STP Display Commands

Many Spanning Tree show commands have already been discussed. This section mentions some additional show spantree capabilities and introduces some extremely useful commands not discussed earlier.

General show spantree Guidelines

A quick look at the output of show spantree ? provides an overview of the options available for this powerful and useful command. Example 7-19 displays the output of show spantree ? from 4.5.1 Catalyst 5000 code.

Example 7-19 Online Help Listing of show spantree Options

The primary options are displayed in the following syntax listing:

These options (and more) are described in the following sections.

Using show spantree mod_num/port_num

It is extremely useful to utilize the mod_num/port_num option when analyzing Spanning Tree behavior on trunk links. It only lists port-level information and does not show the global and local timer values displayed with the VLAN parameter. For example, the command output in Example 7-20 looks at Port 1/1 which is configured as a trunk link carrying several VLANs.

Example 7-20 Output of show spantree mod_num/port_num

Using show spantree active

Another useful show spantree option is the active keyword. The active keyword filters out all of the not-connected ports. This feature can be especially useful during deployments where many ports are not yet connected to end stations or on Catalysts with very high port densities. Example 7-21 shows some sample show spantree output using the active keyword.

Example 7-21 Output of show spantree active

Although optional, it is best to get into the habit of always specifying the vlan parameter. Otherwise, it is easy to waste crucial time looking at output for VLAN 1 (the default) when you thought you were looking at some other VLAN. The same is also true of showspantree statistics and show spantree blockedports.

Using show spantree summary

The show spantree summary command can be useful for getting an overview of the port states on an entire Catalyst device. As illustrated in the output in Example 7-22, port states are listed for every VLAN along with totals for the entire device listed at the bottom.

Example 7-22 Output of show spantree summary

Using show spantree blockedports

The show spantree blockedports command can be used to quickly list all of the blocked (and therefore looped) ports on a Catalyst. The VLAN, trunk, and EtherChannel information is listed for every port. A total is presented on the last line. Example 7-23 displays some sample output from the show spantree blockedports command.

Example 7-23 Output of show spantree blockedports

Using Spanning Tree Logging

In some situations, it is more important to see real-time feedback of Spanning Tree events. This can be enabled with the set logging command, as shown in Example 7-24. For example, set logging level spantree 7 displays STP state transitions. The logging feature was initially released in 2.2 NMP images. Early versions of this feature only show limited information such as when ports enter or leave the Forwarding and Blocking states. Later versions, such as 4.X, show all transitions (such as Listening and Learning mode). This command can also be used to send Spanning Tree transition information to a Syslog server for analysis later or to monitor STP on an ongoing basis.

Example 7-24 Output of Spanning Tree Logging

Using show spantree statistics

If you have a yearning for detailed Spanning Tree information, the show spantree statistics command should keep you happy for a while. This command presents several screens full of information for a single VLAN on a single port. For instance, the output in Example 7-25 displays information for VLAN 1 on Port 1/1 of a Catalyst.

Example 7-25 Output of show spantree statistics

The output of show spantree statistics is broken into five sections. Several of the more useful fields are discussed here. The message age (port/VLAN) field under the BPDU-related parameters section displays two values. The first value (outside the parentheses) displays the age of the most recently received BPDU plus any time that has elapsed since it arrived. This can be useful to determine if the flow of Configuration BPDUs has stopped arriving from the Root Bridge. The second value (inside the parentheses) displays the Max Age for the VLAN, currently at the default of 20 seconds in the sample output. This is the locally configured value, not the value received from the Root Bridge (and actually in use).

The PORT based information & statistics presents some very useful BPDU counter statistics. The first two lines display the number of Configuration BPDUs transmitted and received. The next two lines display the same information for TCN BPDUs. Each line contains two values. The first value (outside the parentheses) displays the number of BPDUs transmitted or received on that port for the specified VLAN (if it is a trunk). The second value (inside the parentheses) shows the total number of BPDUs received for the entire VLAN (all ports).

If you are experiencing STP problems, this information can be used to verify that BPDUs are flowing. However, notice that both ends of a link generally do not increment both the transmit and the receive counters. During steady state processing, only the Designated Port increments the Configuration BPDU transmit counter, whereas the Root Port (or Ports) at the other end only increments the receive counter. The BPDU counters can be invaluable when troubleshooting situations where a link has failed in such a way that traffic cannot flow in both directions. Without this information, it can take days to narrow down the source of the instability.

  • Tip
    Use the BPDU transmit and receive counters to troubleshoot link failure problems. Also, Cisco’s UniDirectional Link Detection (UDLD) can be very useful.

The VLAN based information & statistics section contains helpful information on topology changes. Last topology change occurred shows the time and date that the last change took place. The topology change count field shows the total number of topology changes that have occurred since Spanning Tree initialized on this port. The topology change last recvd. from field shows the port MAC address (the MAC address used in the 802.3 header, not the MAC address used for the BID) of the last bridge or switch to send the current bridge a TCN BPDU. Use these fields to track instability caused by excessive Topology Change Notifications. However, notice that unless you are using PortFast on all of your end-station ports, every time a PC or workstation boots or shuts down it generates a TCN BPDU.

  • Tip
    Use the topology change information in the VLAN based information & statistics section to track down TCN BPDU problems.

About the author


Leave a Comment