welcome to surprise in this video we're going to be talking about spanning tree protocol okay spanning tree protocol also known as STP is a big big big topic on the CCNA exam STP can be extremely daunting at first the good news is STP 4 is a very strict set of rules once you know these rules STP becomes a very straightforward topic before we go any further it's worth mentioning that there are a few different types of STP that have been developed over the years the main ones are standard STP or 802 1d this is the
original STP PVS T which is the Cisco improvement of STP adding the VLAN feature our STP or 802.1 W this is the new and improved STP with a much faster convergence and rapid P VST again it's the Cisco improvement of our STP adding the per VLAN feature so you might be wondering why per VLAN STP well if you have a very large network with lots of switches and VLANs you can use this feature to help you plan for a more efficient Network you'll see what I mean shortly although there are a few different types of
STP they all use a very similar method in this video we'll be looking at the standard STP so what actually is STP STP is a feature used to prevent loops when using redundant switches for example we have three switches they are all linked together and without STP a loop could form causing a number of problems now we'll take a look at some loops and the problems they cause first remember how switches react to broadcast messages or a unicast message with an unknown address the switch will forward that frame out of every port except the one
that received it so if switch B sends a broadcast message both switch a and switch C will forward that message out of all other ports then look what happens switch a and switch C receive broadcast messages so again they forward it out of all up their ports see what's happening here a loop has been formed now look what happens when switch C sends a broadcast message then switch a sends another broadcast message broadcast messages are sent all the time so more and more frames are added to the loop you can imagine how clogged up the
network can get in just a short space of time the result you see here is called a broadcast storm now this broadcast dome will keep getting bigger and bigger and bigger until either one of the switches fail or someone breaks the link by disconnecting or reloading the switch okay let's look at another switch B sends a broadcast message switch a received this message and it does what switches do best it learns the MAC address of that message then look what happens when switch a gets the same broadcast message on another port wait a minute I
just dropped this MAC address on 0 1 now you're telling me it's actually on 0 2 okay fine I'll update my MAC address table so the switch updates as MAC address table but then in the storm we looked at before the same message will keep appearing in different ports so all switches will continuously be updating their MAC address tables this is the second problem with switching loops unstable MAC address tables let's look at the third problem for this one we'll add two host computers so host B sends some data to host a and again if
switch B doesn't know the location of host A's MAC address it will flood the frame out all other ports now for the sake of argument let's say switch c does know the location of host a and it sends the data directly to it remember switch a also received this data so it forwards it as well now switch see not realizing it's a duplicate frame boards the data to host a again see the problem here duplicate frames are being sent all over the place so what's the solution to all these problems well it's actually pretty simple
the switch is simple e-rock one of the ports the switch with the blocked port still receives the data it doesn't physically rip its own cable out it just ignores it this solves all the problems mentioned data cannot loop and therefore no broadcast storms no unstable MAC address tables and no duplicate frames simple right well yes but it's how the switches choose which port to block which is where it can get a little bit tricky STP follows a strict process to decide which port to block and once you notice process in detail STP becomes very easy
or start with a high-level overview step 1 elect a route bridge this is the king or queen of switches step two place all root bridge interfaces into a forwarding state step three each non-root switch chooses a route port this is the best route to the bridge step four remaining links will decide whether or not become designated ports step 5 all other ports are placed into a blocking State and that's really it that's the high-level overview of how STP works now we did mentioned earlier p vs t which adds the per VLAN feature this is actually
the cisco default by the way so with p vs t you could have this set up for VLAN 1 and by changing the configuration you can have this set up for VLAN 20 before we go into the details of how this works you need to know about the poor rolls and states first let's look at rolls rolls to find the job off the ports reports they are the best port to reach at the root bridge designated ports these are ports with the best cost to the root bridge on any other link non designated ports are
all other ports that are in a blocking state we also have states as well as rows these specified the states the ports are in ports can change states while moving from one role to another for example route ports and designated ports will be in the forwarding state we'll take a closer look at States later but for now let's go over them very briefly disabled a port that is shut down blocking a port that is blocking traffic listening not forwarding traffic and not learning math addresses learning not forwarding traffic but is learning MAC addresses forwarding sending
and receiving traffic like normal it's worth mentioning that listening and learning are transitional states ports will enter these states while changing from one role to another okay let's get started with the process root bridge election the way switches elective root bridge is pretty straightforward each switch has what's called a PPD you the bpdu contains the route cost which is the cost of the root bridge the route and the local bed a bed or bridge ID to choosing a root bridge the first part contains the STP priority which has a default value of 32,768 plus the
VLAN number and the second part is the MAC address simply a switch with the lowest overall bed will become the root bridge now you may not notice the switches are arrogant they all think that they should be the root bridge so they list their selves in the bpdu as the root they then share PPD use with each other switch B and switch C both quickly realize as switch a has a much better bid than aging so very quickly they start supporting switch a and change their bpdu to lists which a as the root bridge once
all switches agree switch a has now been elected as the root bridge the next step is simple all ports on the root bridge enter a forwarding State step three is for each non routes wedge to choose the best path to the root bridge these are called reports the report decision is based on the port cost so first we need to take a quick look at port costs okay here are the costs as you can see here we have an old set which is really the standard set but the problem is it was built such a
long time ago it really cater for faster ports this is why we have the new costs you really want to remember these costs if you're gonna take the CCNA exam you need to be ready to predict the route ports okay so back to the diagram the important thing to remember here is the route cost is the collection of each outgoing port to the route let me say that again each outgoing port added together to the route so let's start with the root bridge the root bridge will send a crust of zero it is the root
bridge so there is no cost to reach itself then if we look at switch B it learns the cost from switch a is zero then adds is own outgoing cost which in this case is four then do some quick math 4 plus 0 equals 4 meaning the route cost out of this port is for switch C also comes to this conclusion now they both know they have a route cost of four they then send this to each other can they do some quick math four plus four equals eight this means they now have one port
with the cost of four and another with the cost of eight the root port is based on the lowest cost so in this case they both choose the port with the cost of four so in this case everything has worked out fine but there may be times where the root cost is the same on multiple ports such as duplicate links or when the cost has been changed manually then what in this case the decision comes down to some tie breakers visa lowest neighbor bid two bits earlier when electing a root bridge then if they tie
the lowest neighbor port priority and ports can have their own priority set and if they tie is the lowest neighbor port number this is the actual number of the port itself okay now designated ports in this step the designated ports are decided links that are not reports will go through this to decide whether or not to become designated ports and it is decided like this first they looked at the lowest route cost to the bridge if that ties they look at the lowest bit if that ties again it goes to the lowest neighbor port priority
and if that ties the lowest neighbor port number so it's pretty similar to the tiebreakers of Route ports in this case switch B becomes the designated port blotting the last step in this process is a very simple one every port that is not either a root port or a designated port is put in the blocking State and this is the last step of the STP election process now look I know it's a lot to take in but trust me once you go through these steps practice it and you'll earn it it will have no problem
answering any questions on STP stp very rarely goes wrong usually it's just a case of working out what decisions STP is made okay so the last thing I want to talk about is the kind of downfall of STP convergence that is the time it takes to do all the work and become stable standard 802 D STP was designed quite some time ago at this time if it took a minute to converge after a change it wasn't a big deal nowadays where almost everything we do relies on network access in some way or another especially the
lights-off IP phones and video calls even a few seconds downtime can cause problems before we look at the convergence process which our first look at the timers and what they mean for the port states hello's the hello timer by default is every two seconds this is the time interval where the root bridge will create and send hello messages this lets everyone know everything is still alive and kicking max age max age is 10 times - hello timer by default so that's 20 seconds this is the time the switch will wait before it realizes something's wrong
forward delay 15 seconds by default this is the time between the listening and learning states we will look at this now so religious states earlier let's take another look the forwarding states this state can move directly to blocking a blocking state can't move directly to fording it must first enter the listening state the listening stage this is where the port listens for MAC addresses but without learning any this is in order to stop any potential loops this is held in this state for the forward delay which is by default 15 seconds in seconds it enters
the learning state this is where the switch starts to learn MAC addresses again is held in this state for the forward delay which is 15 seconds after this the port and then moved to a 14-state so do you see the problem here let's take a closer look the link between switch a and switch B goes down switch B will stop getting hello messages from switch a first it will wait for the max-age timer which is 10 seconds then realizing something's wrong it will have to react by moving its link to switch C to its root
port but this is the problem a block ball cannot move to a forwarding state right away if first needs to go through the other states first listening for 15 seconds next it's learning for 15 seconds can enter the forwarding state now everything's working again great but from the link going down it took a 50 seconds to reconverge and in today's network as a hell of a long time and this isn't just for ports connected to switches if you've ever plugged a computer enter a real sister switch or even use packet tracer you may have noticed
that it takes a few seconds for it to turn green and start working this is because STP is running through the listening and learning States there are a few things we can do to help speed up the general convergence such as port fast and bpdu guard but that really is for the access port so the port's that connect to devices like computers the best thing to do is to actually use the new-and-improved rapid spanning tree protocol as I'm sure you can tell by the name it's pretty fast much faster than standard STP we'll cover our
STP in another video but don't worry that core concepts stay the same there are only a few very basic differences for now we watch this video learn the process and practice it over and over again once you get this process down STP really does become a simple topic that's it for STP if you like this video and you want more you need to let us know leave us a comment like and subscribe as long as we keep getting the great feedback you guys have been leaving us the videos will keep on coming thank you for
watching