We rely on STP to prevent loops on our switched networks. In this video, you’ll learn the fundamentals of Spanning Tree Protocol and how STP reacts when changes occur to the network.
<< Previous Video: Network Segmentation Next: Switch Interface Properties >>
Ethernet switches are fantastic devices to use for networking, and to connect two switches together, you would commonly put a cable between both of those switches. However, you’ll run into a problem if you put a second cable between both of those switches. And effectively, create a loop between both of those switches. There is no method to be able to count how many times a frame might go between devices with Ethernet. Because there is no counting mechanism at that media access control layer, those frames will loop around that particular network until you pull one of those cables out of one of those switches.
This loop will quickly bring a network to its knees. As more data is put onto the network, it’s added to the loop and very quickly, you’re able to overwhelm the capabilities of those switches.
This type of problem occurs almost immediately so if you happen to notice there’s an issue, it’s very easy to rewind everything you might have done in the last few minutes and disconnect any of those cables that you may have created redundantly between those switches.
Fortunately, there’s a way to prevent any of this from happening, even if you accidentally create a loop between two switches. This is using something called Spanning Tree Protocol. It’s an IEEE standard 802.1D. And it’s designed specifically, to prevent loops at this media access control layer.
If a port on a switch has been configured to use Spanning Tree Protocol, there are a certain set of states that this particular port might be in. One of these might be a blocking state. The switch may have decided that if it was allowing traffic to go through this particular interface, that a loop would occur on the network. And it’s decided through Spanning Tree Protocol, to administratively block any traffic from going through that port.
While Spanning Tree is converging, it may go into a listening state, where the interface isn’t passing traffic, but it is listening to find out what other Spanning Tree Protocol devices might be on the network.
Once it begins hearing the other devices on the network, it will start adding them to a Spanning Tree table, and this is called a learning mode for that particular port. Once traffic is allowed through the port, it goes into a forwarding mode, which is a fully operational mode to allow traffic to communicate using Spanning Tree Protocol. And you, as the administrator, could decide to completely disallow any traffic from ever going across that interface by administratively disabling the port.
Here’s an example network that’s using the Spanning Tree Protocol. If Spanning Tree was not enabled on this network, you would have a loop as traffic was able to move between any of these networks at any time.
There’s three types of interfaces that are configured automatically through Spanning Tree Protocol. One is the root port. On this network, Spanning Tree has defined one switch as the root switch. There’s only one root switch on any Spanning Tree Network. On all of the other switches, one of those interfaces will be the one that is closest to the root switch. And that is the one designated as the root port.
The root port will allow traffic to traverse this particular interface. And the other interfaces that are on this switch that traffic is allowed to traverse, are called the designated ports. If there’s any port on any of these switches that Spanning Tree has decided to disable to prevent a loop, it will designate that as a blocked port.
Because of this configuration that has been built automatically by Spanning Tree, we can communicate between all of these different networks without the worry of having any loops on the network. This does mean, though, that some of the communication may take a longer path than we might expect.
For example, to go from network Y to network C, we can’t go through bridge 11 because Spanning Tree has blocked one of the ports between those two networks. Instead, network Y would have to go to a network A, then network M, then network J, and network C, to finally complete that communication.
Very often, on a network of this size, we might have some type of change. One of the switches may fail or one of the links between switches may become disconnected. When that occurs, Spanning Tree has to converge the network and restructure which devices are connected through Spanning Tree.
For example, let’s say that this connection between network A and bridge six is severed. Normally, network A would be able to use that connection to go to other parts of the network, but now, that connection is no longer available. Spanning Tree will reconfigure itself now, by sending messages between all of the different bridges, and it will reconfigure the links that this communication can now exist through other parts of the network, while still maintaining a loop-free environment.
One of the newer standards of Spanning Tree Protocol is Rapid Spanning Tree Protocol, or RSTP. You may also hear this referred to as 802.1W. Rapid Spanning Tree Protocol was created because the convergence process with the original Spanning Tree Protocol could take anywhere from 30 to 50 seconds. And on our modern networks, 30 to 50 seconds is a very long amount of time. With Rapid Spanning Tree Protocol, that convergence process takes only six seconds to bring the network back up and running.
Fortunately, Rapid Spanning Tree Protocol and the original Spanning Tree Protocol can both coexist on the same network. So if you have older equipment, you’re still able to take advantage of Rapid Spanning Tree Protocol on your newer equipment and be able to have both of those coexist simultaneously.
And another advantage of Rapid Spanning Tree Protocol is that if you already know how Spanning Tree Protocol works, there aren’t a lot of differences between Spanning Tree and Rapid Spanning Tree, making it very easy for network administrators to easily update to the latest version of Rapid Spanning Tree Protocol.