As a network administrator in charge of enterprise routing, one of your main concerns is providing redundancy in the system. Unfortunately, providing redundancy in a Layer-2 switched network can create physical loops in the topology. To provide redundancy in switched networks without creating loops, Cisco uses the Spanning Tree Protocol (STP).

Physical loops
Physical loops are created in a switched network when two network segments are connected by two or more Layer 2 switches, thus forming a circle. Because switches are designed to flood broadcasts and unknown traffic, there is the potential to loop traffic around the network. Each time a broadcast frame is received on a switch port, the frame is forwarded out of every switch port on the device (unless, of course, the switch ports are assigned to separate VLANs). If two switches are connected by two network segments, this can lead to the broadcast frame being bounced back and forth between the switches. This is sometimes referred to as a broadcast storm. Broadcast storms grow exponentially and can bring a network to its knees. To prevent broadcast storms, the Spanning Tree Protocol (STP) eliminates redundant paths by placing only one switch port in forwarding mode and placing all other ports connected to the same segment in blocking mode.

What is STP, and how does it work?
STP is a network management protocol that is used to prevent loops in a redundant network topology. STP uses the Spanning Tree Algorithm (STA) to calculate the best switch path through the network. The Spanning Tree Protocol then shares this information with other switches on the network. Frames known as Bridge Protocol Data Units (BPDUs) are used to exchange STA calculations between switches. Using the information provided by the BPDUs, the Spanning Tree Protocol “prunes” redundant paths.

When STP prunes a redundant path from the network, it places the switch port that is providing the redundant path into blocking mode. STP repeats this process of blocking switch ports until only one active path is available to the network destination address. This last active path is a switch port that is placed in forwarding mode.

What happens when a link fails?
To reiterate, one of the most important features of an enterprise network is redundancy. If STP prunes all of the redundant links, what happens if the active link fails?

STP sends out BPDUs at regular intervals. If there is a change in the status of a link, the BPDUs report this change, and the STA recalculates the best path through the network. Next, the process of placing one active port in forwarding mode and blocking all other ports is repeated.

Viewing the Spanning Tree information
To view the Spanning Tree information on the Cisco Catalyst line of switches, use the following command:
switch (enable)>show spantree

Want more information?
The Spanning Tree Protocol is a complex network management protocol. Troubleshooting and configuring STP in an enterprise environment can be a nightmare. Before you begin your next STP project, check out “Building Cisco Multilayer Switched Networks” by Cisco Press.

Warren Heaton Jr., MCSE+I, CCNP, CCDP, is the Cisco program manager for A Technological Advantage in Louisville, KY.

If you’d like to share your opinion, please post a comment below or send the editor an e-mail.