Hi and welcome to this CertificationKits CCNA training video on spanning tree protocol. We are going to be talking about the spanning tree protocol and what it does. 802.1D version, 802.1W version also known as rapid spanning tree and then we’ll also be talking about a couple of other features, ether channel and port fast.

We are going to bring up the CCNA slide that I did in our CCNA video and it basically shows two switches, Palestra 1 and Palestra 2 with redundant links. We got redundant links between FA01 on each switch as well as FA02 on each switch. Why would we want redundant links? We want redundant links, so if PC1 and PC2 need to communicate and link one goes down, we have another way for them to communicate. But there is a problem with redundant links between switches. Switches are not made to choose paths between connections and they really open up the possibility for a broadcast storm when you have redundant links between switches so spanning tree is very important. Take a look at a common scenario that happens when there are redundant links between switches but spanning tree is not operating. Let’s say PC1 sends a broadcast message out. Now a broadcast message is a message that’s sent to everybody. So it hits the port on the switch and what does a switch do? A switch forwards broadcast messages out all ports so it would go out FA01 and FA02. Now the broadcast message that comes in on FA01 over here will get forwarded out FA02 over here as well as the port that the computer is plugged on and then FA02.  The packet that comes in here will get forwarded out FA01 as well as the port that the PC is plugged into and what happens is you get this broadcast storm cruising around your network so all these broadcast traffic just starts looping around in network. What does that do to your network? It shuts your network down.

So we need spanning tree because what spanning tree is going to do is it will block one of these ports. I’ve magically wiped my CCNA slide clean and let’s take a look at what happens if we block a port. Spanning tree is going to go in and automatically shut a port down based on certain criteria. With this port FA01 shut down and PC one sends a broadcast message out, it’s not going to go out to this interface because this port is shut down. It will go out here, hit PC2 and it doesn’t end up looping around creating this broadcast storm so it saves us. Let’s take a look at how spanning tree figures out what ports it’s going to block. I’m going to snap my fingers and clear the CCNA slide real quick and let’s go in and figure out how spanning tree is going to block a port. First, it starts off with the switches sending what are called BPDUs back and forth, Bridging Protocol Data Units. They send these BPDUs back and forth every two seconds. The BPDUs are made up of two things mainly and there are some other things in there but the MAC address and what’s called a priority number.

The MAC address of the switch, every switch has its own base MAC address, I’m just going to use four characters here so let’s say the MAC address of Palestra 1 is all ones, MAC address of Palestra 2 is all twos and the priority number which can be changed, but by default is 32768. What they are doing is they are comparing their BPDUs and based on the comparison, one of these switches will be elected the root bridge and what it comes down to is the lower MAC address or base MAC address of the switch.  If the priority numbers match, that device will become the root bridge so based on this, priority numbers match and this is default priority number by the way of 32768 which can be manipulated.  But by default, the numbers match, the MAC address of the switch is what’s going to determine who gets to be the root so Palestra 1 becomes the root. The nice thing about the root is all ports forward. With all ports forwarding on the root, that mans FA01 and FA02 are going to get the green lights. This will not be shut down. So the first criteria is done at this point and the first thing is elect the root bridge or root switch. So that’s the first thing that’s done and the BPDUs with MAC addresses and all that stuff does that.  

The second thing that needs to be done for each non-root bridge which would be Palestra 2 is elect one root port. Meaning one port, that’s the fastest path back to the root bridge and that port is going to get a green light. This situation where both ports are equal; what will happen is and this is a little bit of an assumption on my part; I believe the way they figured out spanning tree to do this when both links are equal speeds, the lower port number would become the root port when both links are in equal space.  So since FA01 and FA02 have equal cost back to the root bridge, FA01 since it is a lower port number gets the green light. It would be really easy for spanning tree let’s say if this were a hundred megabit port and this were a 10 megabit port. Spanning tree actually has cost associated with the speeds of links so a hundred megabit would have a lower cost than a 10 meg port and this again, FA01 would get the green light. That’s the second criteria out of the way.

The third criteria is for each segment and I’m talking about the section of cable here, each segment, there is one designated port so it’s going to a designated port. Now the designated port on each segment is the port that is closest to the root bridge. Over here this cable segment right here between Palestra 1 and Palestra 2, your root port or designated port I’m sorry would be the port that is actually on Palestra 1 which is the root that already has a green light so it kind of is a redundancy as far as green lighting that port and for this segment up here, FA01 on Palestra 1 would be the designated port as well. The three criteria had been looked at. The root bridge, all ports forward, FA01, FA02 on for each non-root bridge, one root port which is FA01 on Palestra 2 and then for each segment there is one designated port so the designated ports for the top segment or FA01 on Palestra 1, FA02 on Palestra 2. All ports or all criteria have been looked at, now we just have to find the port that didn’t match any of these criteria. The port that didn’t match any of the criteria is port FA02 on Palestra 2 so that port gets shut down and what will happen once all these has been figured out? The only device that’s going to be sending out BPDUs is the root and what will happen is Palestra 2 will be receiving those BPDUs on FA01 so again this guy right here is the port that Palestra 2 is going to be receiving the BPDUs on. If for some reason this link goes down, somebody unplugs it or whatever happens. This port goes down, Palestra 2 is not receiving BPDUs anymore from the root, it will open up and automatically start listening on FA02 and go through transitioning this port from blocking to listening and then forwarding.

Now if this link comes back up, spanning tree would automatically reconfigure. So for a quick recap on this, 802.1D spanning tree goes in and it finds a port to block. BPDUs, Bridging Protocol Data Units are sent out every 20 seconds if the non-root switch doesn’t hear from the root after 20 seconds it will automatically start listening on any blocked ports. The amount of time it takes for a chance in the network or a link to go down before all the ports or appropriate ports are back up and listening again is 50 seconds, that’s the default conversations time. It goes in and elects a root bridge, all ports on the root bridge forward. After that, each non-root bridge has one root port and that port would be in the forwarding state and for each segment, it elects one designated port and that port would be on the forwarding state. No there are four spanning tree states that the switch goes through. Blocking state starts off in the blocking state to insure that there will not be any loops taking place then it goes into the listening state where it’s listening for these BPDUs going on every two seconds, it’s getting that BPDU information. After listening it will go into the learning state and the learning state can actually populate its table but it will not forward any information so it populates the table, it does not forward, and once it’s in the forwarding state, it goes ahead and operates normally.

Let’s look at 802.1W, the 802.1W also known as rapid spanning tree has a very similar operation to spanning tree protocol 802.1D version… root bridge, all that, the same way but the big thing is the convergence time, 10-second average convergence time can be as little as one or two seconds which is much faster than the default 50-second convergence time for regular spanning tree. How it does it is the states, there are only three states discarding which is like the blocking state, learning and forwarding state for rapid spanning tree. Discarding and forwarding are the stable states, learning would be a transitory state, how it does it is the improvements are the max age, max age of the BPDU for spanning tree is 20 seconds; rapid span tree goes with the max age of six seconds, there is no listening state so the transitions are much faster and the big thing here is when a link goes down, the switch will actively seek out the new topology. In spanning tree, once the root has been found, so let’s say this is the root switch and here is the non-root and there are redundant links here, I love my artwork.

In this situation in regular spanning tree, if this link goes down, this guy just waits. He’ll start listening and start going through this transitory states, start listening for BPDUs on this port, in rapid span tree, here is the root again, if the link goes down instead of just waiting, he’s going to go out and start inquiring so it actively seeks out the new topology and with the shorter max age, removal of the listening state and actively seeking out the new topology information, you got a 10-second convergence versus a 50-second convergence with regular spanning tree which is so much better. Though to see spanning tree in action I can go over to my CCNA simulator, look at the network map real quick, Palestra 1 connects to Palestra 2. It doesn’t show it here but there are redundant links I’ve configured. FA01 to 01, FA02 to 02 between the two switches. So one of those ports needs to be blocked, if I’m on Palestra 1 and I type in the command that shows spanning tree, type that in, show spanning tree, hit enter, it shows me the priority number as well as the address and it shows me my actual bridge ID, notice it matches. The bridge ID and the priority number, that’s what gets sent out in the PBDU. Now what it shows me down here are my ports that are participating in this. Port 19 is in the forwarding state… port 19 I’m sorry the cost is 19 for the interface. Port FA01 is in the forwarding state. Port FA02 is in the blocking state. What that means is Palestra 1 is not the root bridge. Palestra 2 was elected the root because it had a lower base MAC address so Palestra 1 had to end up blocking a port and I can view this information with the show spanning tree.

There are a couple of other show commands that are very helpful, bring those up, show spanning tree, again I could do an interface option with that, this is optional, shows spanning tree VLAN. What that does is a VLAN allows me to have multiple broadcast domains on one switch. Each broadcast domain would have to have its own version of spanning tree. So to check to make sure spanning tree is running on every broadcast domain I’d specify the VLAN that I wanted to view it for. Debug spanning tree that allows me to actually see the spanning tree, BPDUs, all that information running in real time and that will tell me that it’s up and running as well as the information that’s getting passed back and forth between the switches. Debugging can be very helpful for troubleshooting.

A couple additional things that we can do for our environment to make it more efficient, one of them is configuring ether channel, let me bring up my CCNA slide. And what ether channel does, instead of having these redundant links act separately and having to block a port, I can have them work together and I can group the link between FA01 on both switches and the link between FA02 on both switches.  I can group them together to act as one link and what that would do is it would eliminate the need to block one of these ports as well as if one port did shut down for some reason, I wouldn’t have to go through any convergence or anything because the other link would still be up and running and it might slow down a little bit. But I’d still have this link up and running up here and it would carry all the traffic that both lines carried before so ether channel allows me to group these two links together to act as one.

Let’s take a look at how I would configure that. I set the configuration up in notepad and what I would do is on Palestra 1 I do the same thing on Palestra 2 is I’d go in and I’d go to interface FA01 and I’d got o interface FA01 and I’d say channel group one and depending on the number I put here would determine what group or what other interfaces I grouped it with so I’d have multiple groups.  If I had multiple different redundant links and go channel group one, mode on, turn it on and then I’d go to interface FA02 and I have to specify the same channel group to make the Link on FA02 and the link on FA01 act together.  I’d got channel group one mode on and I turn it on.

There is one other additional feature that’s called port fast. Let’s go take a look at what port fast will do for us. Let me bring my CCNA slide back up and port fast. What that does is this port right here might be port FA03. This port right here, there is a PC connected to that port that is not an uplink port. With port fast, what I can do is when I plug a device into this particular port I can have that port turned on immediately. If I plug something in the FA01, it’s going to take a moment for this link to come up because it wants to make sure that by turning this interface on, it’s not going to introduce a loop into the switching environment and thus introduce broadcast storms and all those problems. This port is not used for up linking so if I know certain interfaces are not going to be used for an uplink, I can use the port fast command and what I’ll do is whenever I plug something right into it, it’s not going to worry about spanning tree. It’s just going to automatically turned on.

Let me show you how to configure that. I’m going to bring up the CCNA simulator and let’s say we’ve got something plugged into FA03 here. So I’ll enter in the Palestra 1, I’m going to go to the interface FA0/3 and turn on port fast. So when we plug something into it, it immediately comes on. I have to use the spanning tree sub interface command and I just type port fast and that will go ahead and make this port an access port, access port I mean a port hat is not used as uplink and it turns it on, the port fast turns that on and says “Hey, whenever something plugs in here, immediately go green, don’t worry about… worrying about any loops or anything like that just go ahead and turn the port on. So again the two additional features are ether channel which groups the links together as one link and port fast which allows us to tell our ports to just automatically go to the forwarding state. We have talked about 802.1D version of spanning tree, 802.1W which again gives us faster convergence, ether channel, and port fast. I hope you have enjoyed this CertificationKits CCNA training video on spanning tree protocol.