Networking Basics: How to Configure Spanning Tree Protocol
The 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.
If you're tasked with managing bridges and switches, you'll probably encounter spanning tree protocol (STP) during your configurations. STP is used to configure backup connections when linking between two bridges or switches fails. It provides the most efficient way to forward information between LAN segments, reducing performance issues — without losing redundancy.
Root Bridge Election
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. The root bridge is considered the center of the network. So, 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.
Spanning Tree Port Cost
Cost settings are important 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.
Spanning Tree Hello Time
Hello time refers to the time between each bridge protocol data unit that is sent on a port and is used to help detect failures. This time is set to two seconds by default, but you can change it to anytime 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 running and functional.
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 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.
Bottom Line of STP
The basic concept to remember about 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, or you can actually decrease network performance with the wrong settings.
CBT Nuggets trainer Jeremy Cioara explains Spanning Tree Protocol more right here:
delivered to your inbox.