-: Spanning Tree Protocol, or STP, 2 2
is an additional ethernet feature that is really important, 3 3
and so we've broken it out into this separate lesson. 4 4
Now, when you look at the number for it, 5 5
it is known as 802.1d, and so I want you to write that down 6 6
in your note sheet as well. 7 7
802.1d is the Spanning Tree Protocol or STP. 8 8
Now what does spanning tree protocol do? 9 9
Well, it allows us to have redundant links 10 10
between different switches, 11 11
and it will prevent loops in our network traffic. 12 12
Now, why is it important to prevent these loops? 13 13
Well, you may remember, 14 14
that we talked about the availability of networks 15 15
is measured in nines. 16 16
We want to have five nines of availability, 99.999% uptime, 17 17
which means that we're only going to get 18 18
five minutes of downtime each and every year. 19 19
Now, if I want to have redundant network, 20 20
I have to be able to have multiple links to create that 21 21
and give me that five nines of availability. 22 22
Now, there's this thing out there called SPB, 23 23
or the shortest path bridging, 24 24
and this is used instead of STP 25 25
for really large network environments. 26 26
Now, we're not going to go in depth into SPB, 27 27
because your exam isn't going to dig into it in depth. 28 28
If you go on to do the CCNP, 29 29
and you start working in higher level networks, 30 30
you may dig into SPB there, 31 31
but for the Network Plus exam, you really don't need to. 32 32
Instead, we are going to dig deep into STP, because STP, 33 33
which is our spanning tree protocol, 34 34
is what we're going to be using for our smaller networks 35 35
that are covered from the Network Plus exam. 36 36
Now, let's take a look at a network 37 37
without spanning tree protocol and see how it works. 38 38
Now, you can see that the Mac address table here 39 39
can have corruption that occurs. 40 40
Let's say, that I have PC2 trying to send a message to PC1. 41 41
You can see that there's a redundant network here. 42 42
It can take a path going from switch four, to switch two, 43 43
to switch one, over to PC1, 44 44
or it can take a path from switch four, to switch three, 45 45
to switch one, to PC1. 46 46
And that looks great, because we have two different ways, 47 47
but, if you remember how Mac address tables work 48 48
inside our switching tables, 49 49
you're going to notice that there's going to be a problem here. 50 50
When PC2 reaches out to talk to PC1, 51 51
switch four is going to learn that the CC Mac address 52 52
for PC2 is coming in from that side. 53 53
Now it's going to broadcast that out 54 54
to switch three and to switch two, who both learn of that, 55 55
and they put that in their Mac address table 56 56
for port 0/2. 57 57
Then, they go and tell switch one, 58 58
and it's coming from both sides, 59 59
so switch one now thinks 60 60
that it can rebroadcast that out both sides, 61 61
which then feeds back to switch two and switch three, 62 62
and this creates a loop known as a switching loop. 63 63
Now you can see it here in red, 64 64
because as the data starts going back, 65 65
these interfaces start figuring out, 66 66
hey, how do I get to network CC? 67 67
Well, the way I get to network device CC, that Mac address, 68 68
is that it comes through both interfaces, 69 69
and so both of those switches now tell me 70 70
that I can go there for CC, 71 71
and that means I really don't know which way to go. 72 72
Because as a device on a network, I can only go one way, 73 73
and I need to choose which way that is. 74 74
Now, this switching loop can happen, 75 75
and we get what's called a broadcast storm. 76 76
This is what's going to happen, 77 77
if you don't have spanning tree protocol in your network. 78 78
But if you do have spanning tree protocol, 79 79
you can actually solve this problem. 80 80
So let's talk about how we can get through this. 81 81
Now we see this broadcast storm that's happening, 82 82
and if this broadcast frame is received by both switches, 83 83
they'll start to forward it to each other, 84 84
and so one tells it, and the other one tells it back, 85 85
and they keep going back and forth. 86 86
Think of it like this. 87 87
I tell you a secret, and then you tell me that same secret, 88 88
and then I tell it to you again, 89 89
and you tell it to me again. 90 90
And we keep doing this over and over, and each time, 91 91
more copies of that secret, in this case, a frame, 92 92
are being forwarded back and forth between each other. 93 93
It can actually start replicating 94 94
and then being forwarded again, and again, and again, 95 95
until your entire network is just consumed up 96 96
by all of these copies of this art packet, 97 97
that's being sent out, 98 98
trying to tell everybody where that device should be. 99 99
Now, it just takes this to happen over time 100 100
through your entire network, and eventually, 101 101
your network will just crash under the weight of this. 102 102
So, if your switch starts having this problem, 103 103
the only way to fix it, 104 104
if you don't have spanning tree protocol involved, 105 105
is to actually unplug the switch, 106 106
wait about 30 seconds for all that data 107 107
to be forgotten and lost, and then plug it back in. 108 108
Now, that's not a great way to run a network, 109 109
so someone decided we're going to create something electronic 110 110
to fix this problem, and that's where STP, 111 111
or the spanning tree protocol, gets involved. 112 112
Now, the way STP works is that it uses a thing, 113 113
called a root and a non-root bridge. 114 114
Now a root bridge is where a switch is elected 115 115
to act as a reference point for the entire spanning tree, 116 116
the switch is then going to select the lowest bridge ID, 117 117
or BID, and that's going to be elected as our root bridge. 118 118
Now, the bridge ID is made up 119 119
of a priority value and a Mac address, 120 120
with the lowest value being considered the root bridge 121 121
inside our network. 122 122
Now, if everything is considered equal, 123 123
we're just going to go with the manufacturer's Mac address, 124 124
being the lowest, and that one will be our root bridge, 125 125
whichever has the lowest assigned Mac address. 126 126
A non-root bridge is every other switch on the topology, 127 127
so one root, everybody else becomes non-root. 128 128
Now let's assume here we have switches 129 129
one, two, three, and four, again. 130 130
How's it going to end up looking 131 131
when we start implementing STP? 132 132
Well, if I look at switch two and switch three, 133 133
their Mac addresses are all twos and all threes accordingly, 134 134
both have the same priority, 135 135
because they're all using the exact same cabling, 136 136
because priority is based 137 137
on the category of cable you're using. 138 138
Now, who is going to end up being my root bridge? 139 139
Well, if all the priorities are the same, 140 140
we're going to go with the one that has the lowest Mac address. 141 141
So, in this case, it's going to be switch number two, 142 142
because it had all twos as its Mac address. 143 143
That makes switch number three, one, and four, 144 144
all non-root bridges. 145 145
Now, when we look at the root bridge, 146 146
switch two, in our case, 147 147
we also have to look at the concept of a root port, 148 148
a designated port, and a non-designated port. 149 149
Now, when I talk about a root port, 150 150
this has to be assigned on every non-root bridge. 151 151
So I talked about switches one, three, four, 152 152
were all considered non-root bridges, 153 153
so each one of those has to have one port assigned 154 154
as its root port. 155 155
Now, the port that is closest to the root bridge, 156 156
in terms of cost and its number, 157 157
is going to be the root port. 158 158
If the cost is equal, 159 159
and all the cost is determined 160 160
based on those cable types we talked about, 161 161
then the lowest port number on the switch will be chosen. 162 162
The way we determine what the cost is, 163 163
is faster cables have a lower cost, 164 164
and slower cables have a higher cost, 165 165
because we want to put things 166 166
on the fastest cable as possible. 167 167
So, if I have a cat three cable, a cat five cable, 168 168
and a cat seven cable plugged into the switch, 169 169
then the port with the cat seven cable 170 170
is going to be considered the fastest port, 171 171
because it has the fastest type of cable on it, 172 172
and therefore, it will be the root port 173 173
on this non-root bridge. 174 174
Now, if you have all the same type of cable, 175 175
all cat five, or all cat six, or all cat seven, 176 176
then we're going to choose the lowest port number, 177 177
in this case, port number one on the switch. 178 178
Now, the designated port is, 179 179
every network segment is going to have 180 180
at least one designated port on it. 181 181
The port closest to the root bridge, in terms of cost, 182 182
will be considered its designated port. 183 183
All of the ports on the root bridge 184 184
are considered designated ports, 185 185
because they all are on the root bridge, 186 186
and therefore, they're really, really fast. 187 187
Now I'll show you this in a diagram, 188 188
so it'll make a little bit more sense here. 189 189
You can see here, 190 190
the non-designated ports are the ports 191 191
that are going to block our traffic for us. 192 192
This is the benefit of STP. 193 193
This is where your loop free topology 194 194
is going to come into play. 195 195
So, as we look at this diagram, you can see, 196 196
I have a single root port on a non-root bridge. 197 197
The non-root bridge was switch number three. 198 198
I designated it as purple, 199 199
because this is the lowest number port. 200 200
Now, it's port 0/1 versus port 0/2, 201 201
and it also has the lowest cost, 202 202
because the cost of 19 is assigned to anything 203 203
that's using fast ethernet or a cat five cable. 204 204
Remember, the faster the cable, the lower the cost. 205 205
Now, all the other ports on this non-root bridge, 206 206
in our case, switch number three, 207 207
are going to be considered non-designated. 208 208
This means that we're going to make them red, 209 209
and if you think of it red, think of it like a stop. 210 210
There's no traffic coming through those ports. 211 211
Now, when I go to the root bridge, 212 212
which was switch number two, 213 213
all of those ports are considered designated. 214 214
These are all going to be considered blue in color, 215 215
as shown in my diagram here, 216 216
and when traffic comes in from PC2 to go to PC1, 217 217
what is going to happen? 218 218
Well, port number 0/2 on switch three is red, 219 219
and it's not going to let traffic go through it. 220 220
It acts as a stop sign. 221 221
Traffic going from switch four, to switch two, 222 222
to switch one, and over to PC1, will be able to go through, 223 223
based on the way the diagram shows it here. 224 224
If it comes all the way around, and it gets to switch four, 225 225
to switch two, to switch one, to switch three, 226 226
it's going to get stopped at the root port, because again, 227 227
the non-designated port here is not going to allow it 228 228
to broadcast back through. 229 229
This is what prevents our loop, 230 230
and this is what's going to make a C for us in the diagram 231 231
instead of a circle. 232 232
That's the whole benefit here 233 233
of using root and non-root bridges 234 234
is that we put blocks in place, 235 235
so that we don't have a circle that completes 236 236
and allows things to create a broadcast storm. 237 237
Now, each port can go through a couple of states 238 238
as they do this process. 239 239
Non-designated ports are not forwarding traffic 240 240
during normal operations, 241 241
that's 'cause they're a red stop sign, right. 242 242
They receive information as a bridge protocol data unit, 243 243
or BPDU, and once they get that information, 244 244
they're not going to do anything with it, 245 245
and they're not forwarding it, 246 246
because again, those are non designated ports. 247 247
They're red, they stop information. 248 248
Now, if a link in the topology goes down though, 249 249
then the non-designated port will detect that failure, 250 250
and it can determine whether or not 251 251
it needs to transition itself into a forwarding state 252 252
and become a designated port or a root port. 253 253
As it goes through that forwarding state, 254 254
it's going to transition through four different states. 255 255
These four states are 256 256
blocking, listening, learning, and forwarding. 257 257
Now first, it's blocking, and when it's blocking, 258 258
this is when it has that big red X on it. 259 259
And it's a non-designated port, 260 260
and it's going to take any 261 261
of those bridge protocol data units, 262 262
and it's going to stop them and not forward them through. 263 263
They're being used at the beginning and on redundant links, 264 264
as shown on the display we had just a few slides ago. 265 265
Then we're going to switch to listening, 266 266
and it'll do this by populating the Mac address table 267 267
and starting to learn, 268 268
but it's not forwarding those frames yet. 269 269
Again, here we're creating that C not a circle, 270 270
and so we don't have a loop that's happening. 271 271
Next, we move from listening to learning. 272 272
Now, it's going to start processing 273 273
those bridge protocol data units, and when it does that, 274 274
the switch is going to determine its role 275 275
inside the spanning tree. 276 276
It's thinking, do I need to become a root port? 277 277
Do I need to become a designated port, 278 278
or should I just stay as non designated? 279 279
Then it's going to decide 280 280
if it needs to go into one of those states, 281 281
as either a designated port or a root port. 282 282
If it decides it needs to do that, 283 283
then it's going to start forwarding those frames 284 284
and those protocol data units. 285 285
Now, this is called forwarding, 286 286
and it starts forwarding those frames 287 287
over and over and over again, 288 288
and it starts taking over the process 289 289
of being the root port. 290 290
Now, in our example, 291 291
we either have a root port or a non-designated port 292 292
that are blocking. 293 293
We have our designated ports, 294 294
which are forwarding things, 295 295
so switch three is not sending traffic through. 296 296
Now, everything is going to go from switch four, to switch two, 297 297
to switch one, to PC1, in our example. 298 298
Now, if switch two goes down, what will end up happening is, 299 299
switch three will go through those four states, 300 300
and it will then be able to start forwarding that traffic. 301 301
It goes from blocking, to listening, 302 302
to learning, to forwarding, 303 303
and it'll take over as the root bridge, 304 304
and its ports will become root ports, 305 305
and they'll have designated ports on them, 306 306
then there'll be able to keep forwarding on. 307 307
Now, all this talk about link cost is really important, 308 308
and I kind of glossed over it earlier in the video, 309 309
so I want to go a little bit more in depth right now. 310 310
The link cost is an association 311 311
with the speed of a given link, as I said before, 312 312
the lower the link speed, 313 313
the higher the cost associated with it. 314 314
And so, as you can see, 315 315
you might have something like a cat three cable, 316 316
which is ethernet, and it's only 10 megabits per second 317 317
Now, because that is a very slow cable, 318 318
it's going to have a very high cost, 319 319
so we'll give it a cost of 100. 320 320
Now, when I go to fast ethernet, which is cat five, 321 321
or 100 megabits per second, that's a faster connection, 322 322
so my cost goes down. 323 323
It goes from 100 down to 19. 324 324
Now, you don't necessarily have 325 325
to memorize these numbers for cost for your exam, 326 326
but you should realize that if you have a lower speed, 327 327
you're going to have a higher number. 328 328
If you have a higher speed, 329 329
you're going to have a lower number. 330 330
In fact, there's this thing called Long STP, 331 331
that's been adopted recently, 332 332
because higher link speeds kept being created, 333 333
and we didn't have much room 334 334
to make those numbers smaller and smaller. 335 335
So, as you can see here, 336 336
with a fiber connection or a cat seven connection, 337 337
which might be 10 gigabits per second, 338 338
we have a cost of two. 339 339
If I went to 100 gigabits per second, 340 340
I really can't go much less than two, 341 341
I might be able to go to one. 342 342
And what they ended up doing with this Long STP 343 343
was adopting values 344 344
that actually go for 100 from a cat three 345 345
to something like 2 million for a cat three, 346 346
and then we might have more room here at the bottom 347 347
for something like a 10 terabit per second connection. 348 348
So again, don't worry too much about the STP cost itself 349 349
and the numbers associated with it. 350 350
If you're dealing with designing a network, 351 351
you can always Google the cost table, 352 352
and you can have it in your hand 353 353
as you're designing the thing. 354 354
So, you don't need to memorize these for the exam. 355 355
So, for the exam, I want you to remember, 356 356
that a lower speed is going to have a higher cost 357 357
and a higher speed is going to have a lower cost. 358 358
If you remember 359 359
that there's that inverse relationship 360 360
between speed and cost, 361 361
you're going to do good on those questions 362 362
that come up on the exam when you're dealing with STP.