Our networks rely on STP to prevent loops between switches. In this video, you’ll learn how STP and RSTP can be used to keep the network running and provide redundant links to network destinations.
<< Previous: Configuring VLANsNext: Switch Interface Configuration >>
When it comes to loop protection, our Ethernet frames aren’t very smart at all. If we were to connect two switches to each other and then connect those switches to each other again, we would effectively create a loop where traffic, especially broadcast and multicast, would begin going back and forth in a circle between these two devices over and over again. And there’s no mechanism in place at that MAC layer of Ethernet to be able to remove these from the network.
You may recall in one of our other videos, we have talked about things like time to live. And that’s part of TCP/IP. At the Ethernet level, there is no time to live counter, so these frames will continue to circle around and circle around and circle around until you break that loop. If you’ve worked with networks for any amount of time, you’ve probably done this accidentally. It’s so easy to accidentally connect switches to each other, especially if the switches are located in different places.
And when this happens, it’s something that can be difficult to troubleshoot. If you’re the one in the closet and you connected and you immediately get feedback that there’s a problem, then you can resolve it pretty easily by removing that interface. But what if somebody else caused the problem and now you have to troubleshoot it? It can become a challenge trying to determine where exactly that loop is occurring. That’s why IEEE 802.1D was created.
This is the spanning tree mechanism. It was created in 1990 by Radia Perlman. If you’re running any size network today, you’re probably running a flavor of spanning tree in your network. A switch is a relatively straightforward device. It is looking at the destination MAC address of the traffic flowing through it.
It examines this MAC address on a big table that it has and if it finds a match in that table that specifies where the destination interface is for that MAC address, it sends the traffic on its way. All of the forwarding decisions inside a switch are based on this MAC address table. If a switch has traffic come in for a destination MAC address that’s not in the table, then it has no choice but to send that traffic to every interface on the switch hoping that it will then get to its destination and then reply back through the switch so that the switch can see where that particular interface happens to be.
This is one of these situations that’s hopefully temporary. You don’t want to flood every interface with all of the traffic going through your switch, so the switch is constantly checking the source MAC addresses and putting them into a table and recognizing where everyone happens to be located on that switch. When you turn on spanning tree on a switch, it may set your interfaces for particular characteristics. One of those may be to set the interface for blocking which means no traffic is going to go in or out of that particular interface.
If spanning tree is just starting or needs to converge, then it may go into a listening mode where the MAC address table is cleared out and it begins listening to see what MAC addresses might be communicating through a particular interface. This is different than being in a learning mode where it is now listening and understanding what interfaces are coming through and it’s beginning to add them now to the MAC address table. We also have a forwarding. This would be when data is normally passing through the interface. This should be normal switch function.
And then we also have a disabled mode which means, in this case, spanning tree is not going to use that interface at all because the administrator on the switch has turned off that port from participating and sending any traffic over the network. In spanning tree, there is one device that is the root on the network. And my root port, I’ve got here at the top of this particular diagram. You can see all of the different networks that I have and you can see there are multiple switches or bridges between all of these different networks.
And there’s many different ways to communicate from one part to the other. In this case, spanning tree has already converged and it has determined the best way to get from network to network without performing any type of loop. There are three different kinds of interfaces then. We have designated ports, these are ports that are used to send traffic over the network. We have root ports, these are the interfaces that are closest to the root.
When you look at each bridge you can see each bridge is going to have a root port associated with it. And we also have blocked ports. These are ports where spanning tree has restricted any traffic from traversing that particular interface. And in this scenario, you could see there are many ways you could get from the root bridge at the very top down to Network Y. And you can see in this particular case, we’ve got some interfaces that have been blocked so that we don’t create a loop.
That means if we need to get down to Network Y we can’t follow this path because it has a blocked port. Network Y is only accessible by following a completely different path down the left side of this diagram. But what if we have a problem? What if during that particular operation of the network we have an interface that suddenly is no longer available? Maybe someone has unplugged the wire or a bridge has gone down.
And in that particular case, we no longer have our path down to Network Y. At this point, spanning tree goes into a converged mode where it tries to understand what has happened on the network and create a better path down to all of the different network segments. So bridge five, for instance, has gone into this converged mode. And you can see bridge 11 has as well because the blocked port is no longer there. Bridge five now configures itself so that it can send traffic through.
It changes its root port so that this is the path back up to the root, and now if we needed to get from this bridge down to Network Y, we’re following a completely different path. Notice our blocked port here on bridge 21 is still blocked because you could still get to Network B through the old method. It’s these changes to get to Network Y that have taken place so that now we can go through this entire network and work around the problem that has occurred.
Spanning tree was great when it came out in 1990, but there have been a number of changes to networking and a number of changes to spanning tree through the years. The latest version of spanning tree is RSTP, this is 802.1W. This is spanning tree standard called Rapid Spanning Tree Protocol. And it’s called rapid because the convergence time for spanning tree can generally take somewhere between 30 to 50 seconds, so if there’s an outage, your network connectivity may be affected for a very long period of time.
With Rapid Spanning Tree Protocol, we can decrease that down to a six second time frame. And for a number of our networking protocols, it may not even realize that a problem has occurred, because in six seconds, the problem has already resolved itself and the network is performing the way it should. The Rapid Spanning Tree Protocol is also compatible with the older 802.1D Spanning Tree Protocol.
So if you had older equipment that didn’t understand the RSTP, you can still have interoperability between those two devices. If you were to look into the details of the way Rapid Spanning Tree works, it’s not an enormous rewrite of spanning tree. The fundamentals are still there. It performs a number of functions a lot faster than the older spanning tree, but it effectively works in a very similar way.