One challenge with switching is the concern of network loops. In this video, you’ll learn how Spanning Tree Protocol (STP) can be used to prevent loops and recover the network if an outage occurs.
If you had two switches and you connected them together with an ethernet cable and then you connected another ethernet cable to those switches, you would create a loop on the network. This means an ethernet frame would loop around that particular connection until you disconnected one of those cables. There’s no mechanism at the Mac address level to count how many times you’ve seen a frame. So as these frames are going around this loop, you’re adding more and more frames to the network all the time. Those are continuing to go around this loop. And eventually, you’ll overwhelm the capacities of your switches.
This can happen relatively quickly. Once you create a loop in a network, it might be a number of seconds until people start calling the help desk stating that the network is down. Fortunately, this is relatively easy to resolve. You simply go back to the switch where you plugged in that cable. You disconnect the cable, which removes the loop from the network, and now everything is back up and running.
But, of course, we’re not always standing in the data center ready to plug or unplug a cable from a switch. We need some type of automated method to recognize a loop on the network and to prevent those loops from occurring. Fortunately, we have a standard that’s able to recognize and prevent loops on a network. This is the IEEE 802.1D standard, one that we call the Spanning Tree Protocol.
Spanning Tree can configure interfaces on our switch in a number of different ways. It may configure the switch port to be blocking, which means it’s not going to forward any traffic. This is commonly used to prevent loops on a network. If we were to plug in that second cable to our switch, Spanning Tree would recognize that a loop was being created, and it would cause one of those interfaces to be in a blocking state.
The listening phase is used by Spanning Tree to clear out existing tables and restart the process. It’s going to go through a learning process where it listens to understand where all of the other switches might be and if there might be any loops on the network already running. And then it will configure an interface to be forwarding, which means traffic can be transmitted through that interface, or it will configure an interface to be blocking. We might also have interfaces that are administratively disabled. Those obviously would not participate in this Spanning Tree process.
Here’s a network that is already running Spanning Tree, and there are a number of switches that are identified as Bridge 1, Bridge 6, Bridge 5, and so on. You can see there are five of them in this particular design. And you can see that many of these switches are connected to each other. And if we didn’t have Spanning Tree running, there would be a loop on this network already.
But on this network, we already have Spanning Tree that’s operational, and it has configured a number of different interfaces. There are three different types that you can see on this screen. One is the root port, or RP. This is the interface on a switch that is connected ultimately to the single root bridge on the network. There’s also a designated port, which would be any other port that can forward traffic but is not the port that is connected directly to the root bridge. And there are blocked ports. These are ports where Spanning Tree has disabled that port from sending or receiving any traffic.
You can see on this network that Bridge 21 has a blocked port and Bridge 11 has a blocked port, and those have been blocked so that there is not a loop on the network. If we were communicating from Bridge 11, you can see there is a single root port, and you can follow that all the way back with those root ports to the final root bridge. The designated ports are also available to be able to send and receive traffic.
In this scenario, let’s say that we’re on Network A, and we’ve been communicating with the device on Network M. You can see that we can communicate through Bridge 6, which has a designated port and a root port that allows us access to Network M. But what if there is a problem on this network and we lose connectivity between Network A and Bridge 6? Now we need some other way to communicate to Network M. But as you can see, there is a blocked port on Bridge 11, so we would not be able to communicate through that connection.
Fortunately, Spanning Tree recognizes that we have this disconnection, and it begins clearing out the existing configuration and relearning the topology of the existing network. Spanning Tree has changed Bridge 5 so that the root port is now on the other side, and it has removed the block port on Bridge 11, allowing us, on Network A, to be able to now communicate all the way through the network back to Network M without having another loop on the network.
On many networks, we do talk about enabling Spanning Tree and making sure that our Spanning Tree configuration is turned on inside of our switches. But in reality, these days, we’re probably running a newer version of Spanning Tree called the Rapid Spanning Tree Protocol. This standard is the 802.1W standard. In the original Spanning Tree Protocol, it might take 30 to 50 seconds for the convergence process to occur. And on today’s networks, that is a very long time to wait without any type of connectivity. With Rapid Spanning Tree Protocol, this convergence process goes down to about 6 seconds, which means any time there’s a disruption on the network, we can be back up and running relatively quickly.
Fortunately, this Rapid Spanning Tree Protocol is backwards compatible with the original Spanning Tree. So if you have a mixed set of devices on your network that support one or the other standard, you can run them all at the same time. Fortunately, Rapid Spanning Tree Protocol works very similar to the original Spanning Tree configuration. It simply operates much faster. There are some shortcuts and other configuration settings within the Rapid Spanning Tree Protocol, but it has such familiarity that if you understand Spanning Tree Protocol, it will be very easy for you to understand the details of Rapid Spanning Tree Protocol.