Technology / Networking

Networking Basics: How to Configure Spanning Tree Protocol

by Team Nuggets
Networking Basics: How to Configure Spanning Tree Protocol picture: A
Follow us
Updated on July 25, 2024

Quick Definition: Spanning Tree Protocol (STP) is used to prevent Layer 2 loops, commonly known as broadcast storms, from disrupting local area networks. STP virtually disconnects redundant links to prevent loops from occurring.

Imagine your network as a bustling city. Without proper traffic control, it would quickly descend into chaos. This is where the Spanning Tree Protocol (STP) comes in. It acts as the traffic cop that keeps data flowing smoothly and prevents network loops that could bring everything to a standstill.

If you manage bridges and switches, you'll likely encounter spanning tree protocol (STP) during your configurations. STP is a network protocol that ensures data travels efficiently between devices by preventing data loops, which can cause network slowdowns or failures. It provides the most efficient way to forward information between LAN segments, reducing performance issues without losing redundancy.

In this article, we'll discuss configuring the spanning tree protocol and its main components and processes. 

How to Configure Spanning Tree Protocol [Video]

Spanning Tree Protocol (STP) is essential for ensuring a loop-free network topology. It involves critical concepts like root bridge election, determining the best path to the root bridge, and managing failovers efficiently. While mastering these concepts can take time, the actual configuration often hinges on a single pivotal command that simplifies the process.

CBT Nuggets trainer Jeremy Cioara explains Spanning Tree Protocol and the main command you'll use right here:

Step-by-Step: How to Configure STP 

STP is a network protocol that ensures data travels efficiently between devices by preventing data loops, which can cause network slowdowns or failures. Below, we'll cover a simplified version for configuring STP. 

Keep in mind that while the core principles of STP remain the same, the specifics of implementation, configuration, and supported features can vary by device and vendor. Refer to your hardware documentation for specific steps.  

1. Identify the Current Root Bridge 

Use the command:

show spanning-tree

This command displays the current STP status, including the root bridge ID, bridge priority, and other important parameters for each VLAN. It helps you understand the current topology and identify which switch is currently acting as the root bridge.

2. Set the Desired Root Bridge Priority

Use the command: 

spanning-tree vlan 1 priority 4096

This command sets the switch's priority for VLAN 1 to 4096. The switch with the lowest priority value becomes the root bridge. The default priority is 32768, and priority values are in increments of 4096. 

By setting the priority to 4096, you ensure that this switch has a higher chance of being selected as the root bridge over others with default or higher priority values.

What is a Root Bridge Election in Spanning Tree Protocol? 

After you connect switches or bridges together, the first thing your hardware does is select a root bridge. This can be any one of the switches, but Cisco normally chooses the switch with the lowest MAC address. It does this because it's likely the longest switch in service, but it could also be the slowest. This is why some network administrators choose to configure switches manually.

STP has an algorithm that identifies the most efficient route to the root bridge. Since the root bridge is considered the center of the network, the algorithm calculates the most efficient route for performance.

Usually, it's more efficient to manually configure the root bridge instead of allowing the algorithm to configure it. As a result, you'll need to set up your bridge or switch when you install your network.

Before you begin, you can see your current root bridge using the "show spanning-tree" command. This will list your VLANs and the several configurations that you can review. You can see if STP is enabled, the priority for the route, the version of STP being used, and the address. You can also see the priority and cost, which are two values you should take note of. You'll likely want to configure both at some point.

The default priority is 32768, and additional roots are set below this number. STP increments priority by 4096, so the next priority is 4096 below 32768. The lower the number, the higher the priority.

What is Spanning Tree Port Cost?

Cost settings are another important concept for STP performance. You can configure cost setting values using the "cost" command. Cost is an integer that represents the best possible route to get from one bridge to another. 

You can change this value manually to force the bridge to block a specific route and work with an alternative. This alternative could technically be physically farther from the root, but the links could have larger bandwidth and speed to account for the manual change.

For most networks, the default cost configured by the switch's algorithm is sufficient for calculating the best cost and route. In rare cases, you will want to manually configure it if you know that a different route is more efficient.

How Does Spanning Tree Hello Time Work? 

Hello time refers to the time between each bridge protocol data unit sent on a port and is used to help detect failures. By default, it is set to two seconds, but you can change it to any time between one and 10 seconds.

For the most part, two seconds is standard and sufficient. When this time is set to two seconds, the switch sends a "hello" message to ensure a route is up and running and functional.

Changing the Spanning Tree Port Priority

By default, in the STP realm, smaller is better. Lower port values are better than higher port values. However, there may be times when you want to change the STP port priority value. In some cases, doing so improves STP's effectiveness. And the best part is you don't have to change the cost.

Changing STP port priority is pretty simple and painless. Use the aforementioned spanning-tree command. From there, you'll be able to see the port's cost and change it to what you want, automatically overruling the default port priority value.

Spanning Tree Protocol Summary 

The basic concept of STP is that lower values increase priority and efficiency. For the most part, Cisco's algorithms can efficiently detect the best routes and priorities. But occasionally, you'll need to configure STP on your network. Just do so with caution, as the wrong settings can actually decrease network performance.

Want to learn more? Take the CBT Nuggets course Fundamentals of STP


Download

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.


Don't miss out!Get great content
delivered to your inbox.

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.

Recommended Articles

Get CBT Nuggets IT training news and resources

I have read and understood the privacy policy and am able to consent to it.

© 2024 CBT Nuggets. All rights reserved.Terms | Privacy Policy | Accessibility | Sitemap | 2850 Crescent Avenue, Eugene, OR 97408 | 541-284-5522