Spanning Tree Protocol – N10-008 CompTIA Network+ : 2.3

We rely on Spanning Tree Protocol to keep our switched networks loop-free. In this video, you’ll learn about the process that Spanning Tree uses to maintain uptime and availability as our networks change.


In an earlier video, we described how IP version 4 has a time to live field, where it will identify when a packet has been looping through separate routers and eventually drop that packet from the network. Unfortunately, with layer 2 ethernet, there is not a time to live mechanism. If you’ve created a loop in the network and a frame is introduced into that loop, there’s no mechanism to drop or remove that frame from the network. The only way that you would stop from occurring is to physically unplug the cable so that the loop no longer exists.

The key with ethernet and switching is to make sure that a loop doesn’t occur in the first place. And we do that by using loop protection. Unfortunately, this is very easy to do on a switched network. You only have to accidentally plug 2 cables in between two switches and you’ve created a loop.

Because there’s no counting mechanism at the MAC address layer, that frame will go back and forth between those switches indefinitely. It doesn’t take long for more frames to be added to the loop, and more and more frames, using up all of the bandwidth and all of the resources on the network. And eventually, there is no communication at all for anything connected to either of those switches. This is relatively easy to resolve. You simply unplug one of the cables, remove the loop, and everything will go back to normal.

Fortunately, we introduced a standard in 1990 that allows us to prevent any loops from occurring on a bridged or switched network this is an IEEE standard 802.1D, and it was created by Radia Perlman to prevent these loops on these bridged networks. This is the spanning tree protocol, and it’s used on many switches to provide a loop-free environment.

When an interface is connected to a network, spanning tree begins the process of identifying whether a loop would be created with that interface or not. And there are a number of modes that interface will be placed in. One of those port states is a blocking port state.

If the spanning tree protocol identifies that a loop would be created by turning on this interface, it will administratively block all traffic from going in or out of that interface to prevent a loop from occurring. To be able to make that determination of whether it should block or not block the traffic, it needs to listen for a certain amount of time to be able to know what devices and switches may already be on the network.

The process of building its own internal topology so that it understands whether a loop may be occurring or not is called the learning port state. Once it is comfortable that no loop would be created, it can begin forwarding traffic. Data will pass through that interface and the interface will be fully operational on the network. Of course, you as the administrator could administratively disable that port. That’s not necessarily part of Spanning Tree Protocol, but it does have an effect on how STP operates.

Here’s a network that we’ll look at to see how spanning tree can prevent loops from occurring. You can see that we have five bridges on this network and they are connecting many different networks together. If we didn’t have spanning tree, you could easily see that you could create on this network where traffic would constantly be going back and forth between all of these different bridges.

But thanks to spanning tree, a number of these interfaces have been disabled so that a loop doesn’t occur. There are three separate modes we’re going to look at for every interface on these bridges. There is a root port– the root port designates the interface that is closest to what we call the root of the network. And only one bridge on the network is the root bridge or root switch.

There’s also a designated port, which is all of the other operational ports on every other bridge. And then there are blocked ports. Spanning tree protocol will identify potential loops and it will disable or block individual ports so that a loop will not occur.

You can see on this network, for example, on network C, if network C wanted to communicate to network Y, it would not be able to pass through bridge 11 because that would create a loop. Instead, one of those interfaces on bridge 11 has been blocked. And if network C wants to communicate to Network Y, it has to go through bridge 21, bridge 1, bridge 6, bridge 5, finally down to network Y.

Let’s look at another communication on this network between network A and network B. You can see that this bridge has all three interfaces enabled. One of them is the root port closest to bridge 1, or the root of the network, and the other two are designated ports, so traffic can traverse all three of those interfaces.

If network A wanted to talk to network B, it would simply communicate through bridge 6. But of course on many networks there could be an outage. Maybe someone cuts a cable or accidentally unplugs a particular interface, and suddenly the connection between network A and bridge 6 is severed. Spanning tree protocol will recognize that there’s been a change to the network and it will converge and recreate the design of the network based around this change.

Spanning tree will recognize that there’s no communication available between network A and bridge 6, which means the root port on bridge 5 is no longer able to communicate to the root bridge of the network. Spanning tree will now change the root port to be the other side of bridge 5 so that network A can now communicate out to network B by using the other direction of the network and eventually make its way all the way down to network B.

One of the challenges with the traditional spanning tree protocol is that convergence process can take anywhere from 30 to 50 seconds. And on today’s networks, that is a very long time to be without any type of data connectivity. To be able to resolve that, there’s an updated version of spanning tree protocol called the Rapid Spanning Tree Protocol, or RSTP. This is also 802.1w as the standard.

This updated rapid version of spanning tree will decrease the convergence time from 30 to 50 seconds down to six seconds. This is also backwards compatible with older spanning tree devices, so you can mix old equipment and new equipment in your network and implement the rapid spanning tree protocol as needed.

This also follows a lot of the same processes and procedures as the traditional spanning tree protocol. So if you know spanning tree protocol, you’ll have no problem understanding the process used for rapid spanning tree protocol.