Spanning Tree (802.1D) – Part 2


This is the 2nd post about 802.1D, also known as spanning-tree. In the previous post, I explained alot of functionality behind the selection of ports on both root bridges as well as non-root bridges. (Remember a switch is a bridge).

In this post, I want to show some examples on what happens in certain scenarios, and how STP reconverges when one of these events occur.

Lets start out with our topology again:

Type of failures:

I want to focus in on two different types of failures that can occur, namely direct link loss, and loss of BPDU’s (for whatever reason).

Link Loss – Scenario 1:

Lets assume that the link between SWA and SWC goes down. So L2 goes down. What happens? Well, SWC uses the port on L2 as its root port, so something must happen. What happens is that SWC sees that it is the designated bridge for L4, so it cant use that as an alternate path to the root as its first priority, instead it looks at the BPDU it receives on L5. SWC’s port to L5 is in a blocking state. So because its a direct-link failure, SWC skips the max-age, because it knows immediately that it lost its root port. Then it turns the blocked port into the listening stage, waits forward-delay time, puts the port into the learning state, waits forward-delay, and finally puts the port into the forwarding state. Also, L4 between SWB and SWC changes. When SWC sends out BPDU’s received through SWD with a cost of 29, and SWB sends out a BPDU with a cost of 19, SWB becomes the designated bridge on that segment. It puts its port through the listening and learning stages and eventually ends up forwarding. In the meantime, SWC puts the port to L4 into a blocking state.

What we end up with is the following scenario:

Link Loss – Scenario 2:

Again, we start with the first topology where L2 works again. Now lets see what happens when L3 fails between SWA and SWD. Nothing really happens at SWA since its port on L3 is designated and in a forwarding state. It just goes down and doesnt participate in STP.

At SWD however, we loose the root port towards SWA. SWD only has a designated port remaining, and cant use any alternate ports. Since SWD hasnt heard any other BPDU’s, it asserts that it must then be the root of the topology. Ofcourse, we know that this is not the case since SWA is still working. Still, SWD sends out a BPDU to SWC where it states it is now the root. SWC however, keeps discarding this inferior BPDU for a time of Max-Age. After Max-Age times out, it starts transitioning its port into listening + learning states, and thereby sends BPDU’s to SWD. SWD will then know that it was wrong, and is not the root, and will put its port into a listening + learning state, and end up with its root-port being the port connecting it to SWC.

In this scenario we end up with:

BPDU Loss – Scenario 1:

Assume that something goes wrong on the link L2 between SWA and SWC. SWC will then stop receiving BPDU’s. After Max-Age, it determines that it has lost its root port. Just as in scenario 1, it will choose its alternate port to SWD as the best root port, it will transition its port to listening + learning and everything will end up exactly like scenario 1.

BPDU Loss – Scenario 2:

The key here is that SWD waits for Max-Age time not hearing any BPDU’s, then it starts transitioning to listening + learning. This also happens at SWC on L5 at the same time, because it itself hasnt heard any BPDU’s on its L5 link for Max-Age. Again we end up with the same result.

The key in all of this is the time it takes to converge. At best convergence is 30 seconds, but it could take up to 50 seconds to have a loop free bridging topology in place. In modern networks where Layer 3 routing protocols can achieve subsecond failover, this is not acceptable.

In the next post, I will describe some optimizations that Cisco made to traditional (802.1D) STP, along with how RSTP (802.1w) has dramatically improved convergence.