Mastering the show spantree Command

Mastering the show spantree Command

The most important Catalyst command for working with STP is the show spantree command. Although this command offers several useful parameters, this section only explains the basic syntax (see Chapter 7 for the full syntax). A sample of the show spantree output from Cat-B in the sample network from Figure 6-6 would contain the information shown in Example 6-1.

Example 6-1. show spantree Output from Cat-B in the Network Shown in Figure 6-6

This show spantree output in Example 6-1 can be broken down into four sections as follows:

  1. Global statistics for the current switch/bridge (lines 2–4)
  2. Root Bridge statistics (lines 5–9)
  3. Local bridge statistics (lines 10–12)
  4. Port statistics (lines 13–16)

The global statistics appear at the top of the screen. The first line of this section (VLAN 1) indicates that the output only contains information for VLAN 1. The second line indicates that STP is enabled on this Catalyst for this VLAN. The final line of this section shows that the IEEE version of STP is being utilized (this cannot be changed on most Catalyst switches). Additional details about these values are discussed in the “All of This Per VLAN!” section at the end of the chapter.

The first two lines of the Root Bridge statistics display the BID of the current Root Bridge. The BID subfields are displayed separately—Designated Root shows the MAC address contained in the low-order six bytes, whereas Designated Root Priority holds the high-order two bytes. The cumulative Root Path Cost to the Root Bridge is displayed in the Designated Root Cost field. The fourth line of this section (Designated Root Port) shows the current Root Port of the local device.

The last line of the Root Bridge statistics section shows the timer values currently set on the Root Bridge. As the previous section discussed, these values are used throughout the entire network (at least for VLAN 1) to provide consistency. The term designated is used here to signify that these values pertain to the bridge that this device currently believes is the Root Bridge. However, because of topology changes and propagation delays during network convergence, this information might not reflect the characteristics of the true Root Bridge.

The local bridge statistics section displays the BID of the current bridge in the first two lines. The locally configured timer values are shown in the third line of this section.

  • Tip
    The timer values shown in the local bridge statistics section are not utilized unless the current bridge becomes the Root Bridge at some point.

The port statistics section is displayed at the bottom of the screen. Depending on the number of ports present in the Catalyst, this display can continue for many screens using the more prompt. This information displays the Path Cost value associated with each port. This value is the cost that is added to the Root Path Cost field contained in BPDUs received on this port. In other words, Cat-B receives BPDUs on Port 1/1 with a cost of 0 because they are sent by the Root Bridge. Port 1/1’s cost of 19 is added to this zero-cost value to yield a Designated Root Cost of 19. In the outbound direction, Cat-B sends BPDUs downstream with a cost of 19—Port 1/2’s Path Cost of 19 is not added to transmitted BPDUs.

  • Tip
    The cost values displayed in the port statistics section show spantree are added to BPDUs that are received (not sent) on that port.

The information displayed by show spantree can be critical to learning how Spanning Tree is working in your network. For example, it can be extremely useful when you need to locate the Root Bridge. Consider the network shown in Figure 6-14.

Figure 6-14. Using show spantree to Locate the Root Bridge

Example 6-2 shows the output of show spantree on Cat-1 for VLAN 1.

Example 6-2 Locating the Root Bridge with show spantree on Cat-1 for VLAN 1

Although this information indicates that the Root Bridge has a BID of 100.00-E0-F9-16-28-00, locating the specific MAC address 00-E0-F9-16-28-00 in a large network can be difficult. One approach is to maintain a list of all MAC addresses assigned to all Catalyst—a tedious and error-prone activity. A more effective approach is to simply use the output of show spantree to “walk” the network until you locate the Root Bridge. By looking at the Designated Root Port field, you can easily determine that the Root Bridge is located somewhere out Port 1/1. By consulting our topology diagram (or using the show cdp neighbor command), you can determine that Cat-2 is the next-hop switch on Port 1/1. Then, Telnet to Cat-2 and issue the show spantree command as in Example 6-3.

Example 6-3 Locating the Root Bridge with show spantree on Cat-2 for VLAN

Cat-2’s Root Port is Port 2/2. After determining Port 2/2’s neighboring bridge (Cat-4), Telnet to Cat-4 and issue the show spantree command as in Example 6-4.

Example 6-4 Locating the Root Bridge with show spantree on Cat-4 for VLAN 1

Because Cat-4’s Root Port is 2/1, you will next look at Cat-3 (see Example 6-5).

Example 6-5 Locating the Root Bridge with show spantree on Cat-3 for VLAN 1

Several fields highlight the fact that Cat-3 is the Root Bridge:

  • The Root Port is Port 1/0. Note that Catalyst 4000s, 5000s, and 6000s do not have a physical port labeled 1/0. Instead, the NPM software uses a reference to the logical console port, SC0, as a “logical Root Port.”
  • The local BID matches the Root Bridge BID.
  • The Root Path Cost is zero.
  • The timer values match.
  • All ports are in the Forwarding state.

The search is over—you have found the Root Bridge located at Cat-3.

About the author


Leave a Comment