-: So how does a router make its routing decisions? 2 2
Well, it uses a routing table. 3 3
Just like our switches used a MAC address table 4 4
or a CAM table we're going to use routing tables 5 5
to decide where our packets need to go inside 6 6
and outside of our networks. 7 7
Now, these routing decisions are going to contain 8 8
layer three information, 9 9
and they're going to do a layer three to layer two map. 10 10
The router is going to use an ARP cache to map an IP address 11 11
to a given MAC address. 12 12
And this way it knows inside it's local area network 13 13
which IPs are going to relate to which MAC addresses. 14 14
Now each packet forwarding decision is then going to be based 15 15
on it's internal routing table. 16 16
Those internal routing tables are really focused on the 17 17
logical address side of things or that IP address. 18 18
So let's dig a little bit deeper into these routing tables 19 19
to really see how they work. 20 20
These tables are kept by the router 21 21
and they help them determine which route 22 22
is best fit for them, 23 23
as they're trying to route the traffic 24 24
throughout the different networks. 25 25
Now a route entry has a prefix and the longer the prefix is 26 26
the more specific that network is. 27 27
So if we look here at this chart, 28 28
I have three different networks showing up. 29 29
There's 125.0.0.0. 30 30
I have 161.5.0.0. 31 31
And I have 134.7.0.0. 32 32
Now, which of these would have the longest prefix? 33 33
Well, it's the bottom two because they're the most specific. 34 34
These are the ones that are most specific 35 35
because they have the first two octets specified. 36 36
Whereas the first one with the 125.0.0.0 37 37
only has the first octet specified. 38 38
So it is the least specific. 39 39
So if I'm dealing with something like 10.1.1.0/24, 40 40
that is really really specific because I have 41 41
the first three octets specified, the 10.1.1. 42 42
That means I only have 256 possible IPs left 43 43
because of that .0 at the end. 44 44
Now, instead if I use something like 10.0.0.0/8 45 45
this means I only have one octet specified 46 46
and the other three are really wild cards. 47 47
So I can have up to 16 million IP addresses 48 48
because of those three sets of zeros. 49 49
So you can see here the longer the prefix we have 50 50
or the higher the CIDR notation, 51 51
the more specific that route becomes. 52 52
Now, when we look at these routing tables 53 53
and we look at all the routes in the table, 54 54
those routes are going to tell us 55 55
what the destination network is 56 56
and which router it should go to to get to that network. 57 57
It'll also tell us which port on the router is going to be used 58 58
to send traffic out and the cost of that route, 59 59
which is basically like switching, 60 60
where it's dependent upon numbers of different factors, 61 61
like the link speed and other factors like that. 62 62
Now we're going to talk specifically about those different 63 63
factors in another lecture 64 64
when we start diving into routing protocols. 65 65
But for now just realize that every link in a route 66 66
does have a cost associated with it. 67 67
So what are some of the sources of routing information 68 68
that we can have? 69 69
Well, there are really three different sources 70 70
that routers are going to use. 71 71
The first one is called a directly connected route. 72 72
Now a directly connected route is learned by 73 73
a physical connection between two routers. 74 74
So if you look on the screen here, 75 75
I have three different routers. 76 76
Router one, router two, and router three. 77 77
Now router two knows where router one is and router three 78 78
are because it has direct cabling between those 79 79
and this is shown by those zigzag lines 80 80
or that lightning bolt looking line 81 81
that's here on my diagram. 82 82
This denotes that it is a serial connection. 83 83
Next we have static routes and this is the second way 84 84
that routers know how things are connected to them. 85 85
Now a static route are routes that are configured 86 86
by an administrator manually. 87 87
So for example, 88 88
router one knows how to get to router two 89 89
because it's directly connected, 90 90
but it doesn't know how to get to router three yet. 91 91
So for me to tell it how to get through router three, 92 92
I can put a route into my routing table that says 93 93
every time you want to send something to router three, 94 94
just go ahead and send it through router two. 95 95
That would become a static route. 96 96
Now, there is always one default static route 97 97
in every router. 98 98
And it's a special one. 99 99
It's known as 0.0.0.0/0. 100 100
Basically it says to the router, 101 101
if you don't know where to go, just go here. 102 102
It's kind of like your default gateway. 103 103
And so for router one, 104 104
it might have a default route of 0.0.0.0/0. 105 105
That says go to router two anytime you don't know 106 106
how to get someplace. 107 107
And then it becomes router two's problem 108 108
to figure out what to do with that traffic. 109 109
Now the third way that routers can do this 110 110
is by using what's known as dynamic routing. 111 111
And this is done by using dynamic routing protocols. 112 112
These protocols are learned by exchanging information 113 113
between routers automatically based on the protocols. 114 114
Now, instead of me having to go into router one 115 115
and tell it how to get to router three, 116 116
instead I can just let router two do it. 117 117
Now, the idea here is that when router one 118 118
and router two become directly connected, 119 119
they start sharing their routing tables. 120 120
So router one is going to say, hey router two, 121 121
do you know how to talk to some people? 122 122
And router two will say, 123 123
oh yeah, I'm connected to router three. 124 124
So anytime you've got something for router three, 125 125
just send it to me and I'll pass it on for you. 126 126
And they do this all by themselves automatically 127 127
using these dynamic routing protocols. 128 128
This is really great especially in large networks 129 129
because we don't have to manually configure everything. 130 130
So for example, 131 131
think about if I took your router at home 132 132
and I had to put down every single route for you 133 133
to be able to find every website 134 134
you wanted to get to on the internet. 135 135
You would not be able to do it. 136 136
It is just too many things out there, right? 137 137
So instead we use dynamic routing to accomplish this. 138 138
When you connect to the internet, 139 139
you connect to your ISP and they know that they are 140 140
now your default route. 141 141
Anything you want to get to that's not inside your network 142 142
you send it to your ISP 143 143
and then your ISP will send it to the next router. 144 144
And it keeps going up that chain that way. 145 145
So that's a great overview of 146 146
the three different types of routes. 147 147
We have directly connected routes, 148 148
static routes, and dynamic routes. 149 149
So let's go ahead and dig a little bit deeper into each of 150 150
these three types so you can understand them 151 151
a little bit more. 152 152
First, let's take a look at a directly connected route. 153 153
When we look at a directly connected route, 154 154
it's going to look something like what you see here 155 155
on my screen. 156 156
Now as you can see router one and router two are directly 157 157
connected with that zigzag line. 158 158
That's that serial connection. 159 159
Now these routers both know how to get to the other switches 160 160
because they're directly connected to them, right? 161 161
So if I look at router one's table, 162 162
it says I'm connected to 10.0.1.0/24, 163 163
which is the network that it owns on switch one. 164 164
It's also connected to 192.1.1.0, 165 165
because this is the serial connection 166 166
between the two routers. 167 167
Now notice that router one does not know how to get to 168 168
the 10.0.2.0 network, 169 169
because this is on switch two 170 170
and that's hanging off of router two. 171 171
It has no information on this because it only knows things 172 172
that are directly cabled to it. 173 173
Now, if we go further into static routing, 174 174
I can actually write that down as part of my default route 175 175
or 0.0.0.0 for router one. 176 176
Now this tells me that anytime I don't know an IP address, 177 177
I'm simply going to send it out port serial 1/1, 178 178
which is going to push it over to router two. 179 179
And so in this case, if PC one tries to get to PC two, 180 180
it would get as far as router one 181 181
and then router one's going to say ugh, 182 182
I don't know how to get to 10.0.2.2, 183 183
but maybe router two does. 184 184
And it's going to push that over to them 185 185
over that wide area network connection, 186 186
that serial connection that's directly connected. 187 187
That's how this manual configuration works 188 188
with a static route. 189 189
Alright, so I think you understand how 190 190
direct connections work and how static routing works. 191 191
Let's take a look at the dynamic routing protocols instead. 192 192
Now dynamic routing protocols can have more than one route 193 193
for an existing network. 194 194
If I have a more complex network diagram, 195 195
like these five routers that you see here, 196 196
and I wanted to get from one to five, 197 197
I can go a couple of different ways. 198 198
I can go one, two, three, four, five. 199 199
And I really just start zigzagging all over the network. 200 200
Or I might go one, two, four, five. 201 201
Or I might go one, three, four, five. 202 202
There's lots of different ways for me to go 203 203
because all the different connections that are there. 204 204
So how does my router know which one is best? 205 205
Well, the dynamic routing is going to get negotiated for us 206 206
based on the number of hops that are there, 207 207
which is the number of times I have to 208 208
go through a different router, 209 209
the number of link bandwidth that's available. 210 210
So how fast it is. 211 211
I might go through the ones that are faster or slower 212 212
and other criteria that are out there. 213 213
All of these dynamic routing protocols can be able to be 214 214
supported depending on what routers you're using 215 215
and different criteria of how you want to set them up, 216 216
depending on how we configure them. 217 217
Now we're going to spend an entire lesson 218 218
on the different types of dynamic routing protocols. 219 219
So we can really dig into each of them. 220 220
And you can really understand because you're going to get 221 221
test questions on them come test day. 222 222
Now, the last thing I want to talk about in this lesson 223 223
is preventing routing loops. 224 224
Just like we had an issue with switches 225 225
where you can get loops and broadcast storms, 226 226
you can get issues with routing 227 227
if things start going into a circular manner. 228 228
Things will just end up getting lost in cyberspace, right? 229 229
So, to prevent that we have two different techniques 230 230
we can use. 231 231
These are known as the split horizon and the poison reverse. 232 232
Now with the split horizon, 233 233
this is going to prevent a route that's learned 234 234
on one interface from being advertised back out 235 235
that same interface. 236 236
So in this example, 237 237
you see router one knows how to get to router two 238 238
because of that direct connection between those two routers. 239 239
Now it's not going to go and tell router two 240 240
how to get to router two based on that same connection, 241 241
because guess what, it came in that connection. 242 242
So it can't go out the same connection. 243 243
This is essentially what our spanning tree protocol 244 244
did for us in our switching networks. 245 245
But now we can do this inside of routing. 246 246
Now, the second way we do this is what's known as 247 247
a poison reverse and a poison reverse is going to cause a route 248 248
that's received on one interface to be advertised back out 249 249
that same interface, but with a really really high cost 250 250
so that nobody would ever want to use it. 251 251
Now, these are just two different techniques 252 252
for you to stop writing loops. 253 253
You could use one or the other. 254 254
It really doesn't make a difference. 255 255
As long as you're using one, 256 256
it's going to prevent that running loop for you. 257 257
The first one is I'm just not going to repeat anything. 258 258
The second one is, I'm going to repeat it, 259 259
but I'm going to tell you it's so expensive 260 260
that you'll never ever want to use it. 261 261
So let's go ahead and take a look at an example 262 262
of these routing loops 263 263
and how we can make sure we prevent them. 264 264
So here's a network with no issues at all. 265 265
I have three routers here. 266 266
I have router one, router two, and router three. 267 267
You can see the different networks based on the IPs 268 268
and their routing tables are shown here on the screen. 269 269
Now we're going to look specifically at the routing tables 270 270
for router two and router three in this example. 271 271
Now, if I start having an issue, like for instance, 272 272
the network connection from router three, 273 273
for the 10.1.4.0 network went down 274 274
because ethernet 0/1 went down, 275 275
what do you thinks going to happen? 276 276
Well, router two still thinks it can get to that network 277 277
because it says, hey, 278 278
I can get there through my serial port of 0/1, 279 279
because I have a connection to router three. 280 280
Now if router three went down, it's going to say, 281 281
I don't know how to get there anymore. 282 282
And so it's going to ask its friends 283 283
using the dynamic router protocols. 284 284
And so at this point it's going to say hey router two, 285 285
do you know how to get to that network? 286 286
And what happens is router two would say oh yeah, 287 287
I know how to get to that network. 288 288
I can do it in just one hop. 289 289
So go ahead and send it to me. 290 290
And then router three says, oh great. 291 291
That means I know how to get there too, 292 292
because I'm connected to you router two, 293 293
and you know how to do it. 294 294
So that one hop for you becomes two hops for me 295 295
and it keeps going back and forth. 296 296
And then router two goes, oh, I know how to get there. 297 297
Router three knows how to get there. 298 298
And he says, he can do it in two hops, 299 299
so I can do it in three hops. 300 300
And it keeps going back and forth until both of those 301 301
get to be such a high number that neither of those routers 302 302
can actually ever get to that route anymore. 303 303
Now, this is the idea of what a poisoned reverse would do. 304 304
But when you use a poison reverse 305 305
instead of making it go one at a time 306 306
and keep iterating up, it would immediately just say hey, 307 307
I know how to get there and it will take me a thousand hops. 308 308
And so it's got such a huge cost 309 309
you won't want to send it to me. 310 310
That's the way that router three can say, 311 311
I don't have this route anymore. 312 312
Now if you don't use poisoned reverse 313 313
and you don't use split horizon, 314 314
what ends up happening is you have this loop that happens. 315 315
And two says I can do it in one, 316 316
three says I can do it in two. 317 317
Two says I can do it in three and they keep counting up. 318 318
And that eats up a lot of your resources in your network 319 319
by causing this loop 320 320
and those two sending packets back and forth to each other 321 321
continually increasing that cost until it gets so high 322 322
that they stop sending traffic. 323 323
Now if there's no other way to get to that network, 324 324
it's just going to keep going in this infinite loop 325 325
and that's going to cause a real problem for you. 326 326
This is why it's really important to make sure you're 327 327
setting up your poison reverse or your split horizons.