Transcript for:
Essential CCNA Routing Fundamentals Overview

Welcome to Jeremy’s IT Lab. This is a complete course for the CCNA, Cisco Certified Network Associate, exam. In this video we will cover routing fundamentals, a very important topic to understand for the CCNA exam. In the Ethernet LAN Switching videos we looked at how switches forward frames to their proper destination. The process routers use to forward packets to their proper destination is different, and that’s what we’ll look at in this video. Here’s what we’ll cover in this video. First I’ll answer the question: what is routing? Then we’ll look at the routing table on a Cisco router. Switches have MAC address tables, and routers have routing tables. It’s very important that you know how to read a router’s routing table. Specifically, we will look at two types of routes found in a routing table: Connected and Local routes. We will also look at routing fundamentals, specifically route selection. In a router’s routing table, they will usually have a variety of routes. So, how does the router select the correct route for a packet? We’ll discuss that in this video. I want to emphasize that this lesson is extremely important for the CCNA and for learning networking in general, and so is the next video. So, take it step by step, take notes, and ask questions if you need help. After covering all of the material I will also show a 1-slide review of everything in this video, so I hope that will help you review and remember what you learn. Let’s get started. So, what is routing? Well, when a router receives a packet, it’s the router’s job to forward it, to send it, to the correct destination. That’s where routing comes in. Routing is the process that routers use to determine the path that IP packets should take over a network to reach their destination. And routers store routes to all of their known destinations in a routing table, which we’ll look at soon. As I mentioned before, switches keep a MAC address table with their known destination MAC addresses, and routers keep a routing table with their known destination networks. When routers receive packets, they look in the routing table to find the best route to forward that packet. There are two main routing methods, methods that routers use to learn routes. One is ‘dynamic routing’, in which routers use dynamic routing protocols such as OSPF to share routing information with each other automatically and build their routing tables. We will cover dynamic routing protocols such as OSPF later in the course. Another type is, static routing. In this case, a network engineer or admin manually configures routes on the router. We will cover static routing in the next video. In this video we’re going to cover a kind of route that doesn’t fit into either category. Now, what exactly is a route? Basically, it’s an instruction to the router. A route tells the router: to send a packet to destination X, you should send the packet to next-hop Y. And next-hop means the next router in the path to the destination. Or, if the destination is directly connected to the router, send the packet directly to the destination. Or, if the destination is the router’s own IP address, receive the packet for yourself, don’t forward it. This is how the routing table works, it’s a set of instructions like this. To demonstrate routing in this video and the next one, we will use this example network. Actually, in this video we will only look at one small part of this network. In the next video we will use the entire network, but first let me introduce the network. There are four routers connected together, and they represent a WAN. WAN stands for Wide Area Network, a network that extends over a large geographical area. For example, each of these four routers could be in different cities or even different countries. And then, connected to R1 and R4 there are two LANs, local area networks. I’m only showing one PC at each LAN, but let’s say each of these LANs is a different office in a different city, so really there are more hosts in each LAN. R2 and R3 probably should have their own connected LANs too, but just to keep the diagram a bit cleaner I’m not showing them here. Now let’s look at the IP addresses each device will be using. For this LAN connected to R1, the network is 192.168.1.0/24 and R1’s G0/2 interface IP is .1 and PC1’s IP is .10. Then, this WAN connection between R1 and R2 is 12.0/24. R1 G0/1’s IP is .1 and R2 G0/0’s IP is .2. This WAN connection between R1 and R3 is 13.0/24, with R1 G0/0 as .1 and R3 G0/0 as .3. The WAN connection between R2 and R4 is 24.0/24, with R2 G0/1 as .2 and R4 G0/0 as .4. Then the final WAN connection, between R3 and R4, is 34.0/24, with R3 G0/1 as .3 and R4 G0/1 as .4. Then, the LAN connected to R4’s G0/2 interface is 192.168.4.0/24, with R4 G0/2 as .4 and PC4 as .10. Notice that I made all of the router IP addresses the same as their name. All of R1’s IP addresses are .1, R2’s IP addresses are .2, R3’s are .3, etc. Don’t expect IP addresses like this in real networks, but in lessons and labs I will often use simple addressing schemes like this to make it easier to understand. In the next video, we will configure static routes on the routers to allow PC1 and PC4 to communicate with each other over the network. This video will focus on two types of routes automatically added to a router’s routing table, not dynamic routes or static routes. Okay, before looking at routes let’s configure the IP addresses. I’ll just show the configurations on R1, since that’s the router we’ll be focusing on in this video. First I configured its G0/0 interface with IP ADDRESS 192.168.13.1 255.255.255.0, and then enabled it with NO SHUTDOWN. Then I configured G0/1’s IP address. Notice that, while I was still in interface config mode for G0/0, I used the INTERFACE G0/1 command directly, without returning to global config mode first. There is no need to use EXIT to return to global config mode before entering INTERFACE G0/1. You can use the INTERFACE G0/1 command directly from interface config mode. I then configured G0/2 as well. To confirm, I used SHOW IP INTERFACE BRIEF, and you can see the IP addresses I just configured. Of course, I configured the other routers’ IP addresses too, but for the sake of time I won’t show them here. As I said, in this video we’ll just focus on R1. Now let’s take a look at R1’s routing table. The command is SHOW IP ROUTE, it displays the router’s routing table. And here is the output. There are two main sections to the output, the ‘codes’ at the top and the actual routes at the bottom. The Codes legend in the output of SHOW IP ROUTE lists the different protocols which routers can use to learn routes, as well as the codes that represent them in the routing table. I’ve highlighted two in blue here, the first is L, which means local. This code is used for routes to the actual IP address configured on the router’s interface, and these routes will have a /32 mask. If you look at the routes below, notice there are three routes with L, that I’ve highlighted in blue. One for each of R1’s interfaces. Then there is the C code, which means connected. These are routes to the network the interface is connected to, with the actual netmask configured on the interface. Notice there are also three routes with the C code in the output below. So, even though we haven’t configured any routes yet on R1, it already has six routes. When you configure an IP address on an interface and enable it with the NO SHUTDOWN command, 2 routes per interface will automatically be added to the routing table. A connected route, and a local route. Earlier I mentioned that there are two main types of routing: dynamic routing and static routing. These connected and local routes, however, are neither. They are simply added automatically when an interface is configured. These are the routes we will focus on in this video. Okay, let me explain these routes in more detail. So, I’ve highlighted two of the routes, one connected route to 192.168.1.0/24 and one local route to 192.168.1.1/32. So, a connected route is a route to the network the interface is connected to. R1 G0/2’s IP is 192.168.1.1/24. What do the red and blue numbers mean here? Well, because it’s a /24 address the first 24 bits, the first 3 octets, are the network portion of the address. I’ve highlighted that portion in red. Then the last 8 bits, the last octet, is the host portion of the address, and I’ve highlighted it in blue. When you change that host portion to all 0s, the result is 192.168.1.0/24, and notice that’s the destination of that connected route. It’s a route to that network. So, this provides a route to all hosts in that network, for example 192.168.1.10, .100, .232, etc. Any address in that .0/24 range. Look back up at the routing table, and notice that the route says ‘192.168.1.0/24 is directly connected, gigabitethernet0/2. So, R1 knows: if I need to send a packet to any host in that network, I should send it out of G0/2. Okay, that’s the connected route. Next, let’s look at the local route in more detail. A local route is a route to the exact IP address configured on the interface. A /32 netmask is used to specify the exact IP address of the interface. /32 means that all 32 bits are fixed, they can’t change. So, even though R1’s G0/2 is configured as 192.168.1.1/24, the local route is to .1/32, which specifies only that single address. It doesn’t include 192.168.1.2, for example. So, with this route R1 knows: if I receive a packet for this IP address, the message is for me. It’s to my own IP address. Just to make things clearer, let me show it like this. /24 means that the netmask is 255.255.255.0. The first 24 bits of the netmask are all 1, so each octet is 255. These bits are fixed, they can’t change. However the last 8 bits, the last octet, are not fixed. They can be any number. So, the route for 192.168.1.0/24 matches 192.168.1.0 to 192.168.1.255. That means that if R1 receives a packet with a destination in that range, it will send the packet out of the G0/2 interface. Let’s see some examples. A packet with a destination IP address of 192.168.1.2 is a match, because the IP address begins with 192.168.1. Because it’s /24, the first 3 octets have to match. So, R1 would send the packet out of G0/2. 192.168.1.7 would also match this route, so R1 would forward the packet out of G0/2. Likewise 192.168.1.89. A packet destined for 192.168.2.1, however, does not match. It cannot use this route, because the destination does not begin with 192.168.1. So, what would R1 do with this packet? It would send the packet using a different route, or drop the packet if there is no matching route. The term ‘match’ is very important and I will use it a lot in this video and others. A route ‘matches’ a packet’s destination if the packet’s destination IP address is part of the network specified in the route. Using an example on the right, 192.168.1.2 is part of the 1.0/24 network, so the route matches the destination IP. Destination 192.168.2.1 is not part of that network, so the route does not match that destination IP. Now, the local route to 192.168.1.1/32 is simpler. Because it’s /32, all bits of the netmask are 1, so its 255.255.255.255. All of these bits are fixed, they can’t change. So, 192.168.1.1/32 matches ONLY destination 192.168.1.1, no other IP addresses. Okay, we looked at those connected and local routes that were automatically added to R1’s routing table when we configured IP addresses on its interfaces. Now let’s look at another fundamental concept: route selection. So, R1 has a connected route to 192.168.1.0/24 and a local route to 1.1/32, Let’s say R1 receives a packet and the destination IP is 192.168.1.1. Can you see the problem here? A packet destined for 1.1 is matched by both routes: 192.168.1.0/24 and .1/32. So, which route will R1 use for a packet destined for 1.1? Will it send the packet out of G0/2, or will it receive the packet, because the packet is for R1 itself? The answer is, it will choose the ‘most specific’ matching route. So, I explained what a matching route is, let’s see what ‘most specific’ means. The route to 192.168.1.0/24 includes 256 different IP addresses, from 192.168.1.0 to .255. On the other hand, the route to 1.1/32 includes only 1 IP address, 192.168.1.1. It specifies just one IP address, not 256 different IP addresses, so this route is more specific than the /24 route. So, when R1 receives a packet destined for 192.168.1.1, it will select the route to 1.1/32. So, R1 will receive the packet for itself, rather than forward it out of G0/2. That’s the purpose of Local routes, they tell the router: keep the packet, don’t forward it. This means R1 will de-encapsulate the packet and look at the contents inside, because the contents are addressed to R1 itself. So, to summarize: the most specific matching route means the matching route with the longest prefix length. Both parts of that statement are important: the route must match the packet’s destination, and it also must have the longest prefix length out of all of the matching routes. That is the route that the router will use for the packet. Now, let me point out these statements here in the output of SHOW IP ROUTE on R1. You might have noticed them and wondered what exactly they mean. The top one says 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks. What exactly does that mean? Well, first of all its important to know that these three lines are not routes. They mean the following. The first line, 1.0/24 is variably subnetted, 2 subnets, 2 masks, means that in the routing table there are two routes to ‘subnets’ that fit within the 1.0/24 Class A network, with two different subnet masks, those being /24 and /32. The other two mean the same thing for their respective networks. To really understand these statements, you have to understand what a subnet is, but we haven’t covered subnets yet in the course. We will cover subnetting soon, in another video. For now I just wanted to point out that these three lines are not routes, so you don’t get confused by them. Generally, you can ignore this output in the routing table and just focus on the routes themselves. Now let’s look at a few examples to practice route selection. R1 receives a packet destined for 192.168.1.1. Looking at its routing table, which route will it select for this packet? And what will it do with the packet? If you want, you can pause the video now to think about the answer yourself. So, we have to find the most specific matching route in the routing table. This first packet is destined for 192.168.1.1, and when R1 checks its routing table it will see that the most specific match is this one, to 192.168.1.1/32. It is a local route, so R1 will receive the packet for itself. Note that this packet matches two routes in the routing table, the route for 1.0/24 and the route for .1/32, but the /32 route is more specific, so it will be selected. Here’s another example. Packet 2 has a destination IP address of 192.168.13.3. Which route will R1 select for this packet? And what will it do with the packet? The most specific matching route, actually the only matching route for this packet, is this connected route to 13.0/24. So, R1 will send the packet to the destination, which is connected to the G0/0 interface. Here’s a third packet, destination IP 192.168.1.244. What will R1 do with this packet? The only matching route is this one to 1.0/24, so R1 will use this route to forward the packet. It’s a connected route, so R1 will send the packet to the destination, which should be connected to that interface. And here’s a fourth packet, destined for 192.168.12.1. What will R1 do with this packet? There are two matching routes, but the most specific one is this Local route for 192.168.12.1/32. So, R1 will receive the packet for itself. Okay, let’s do one more practice question. Packet 5 is destined for 192.168.4.10. What will R1 do with this one? Because there are no matching routes in the routing table, R1 will have to drop this packet. Unlike switches, which flood frames if they don’t know where the destination is, routers do not. Routers never ‘flood’ packets. If the router doesn’t have a route to the packet’s destination, it will drop the packet. Okay, now let’s try to review everything in this video in one slide. This will be just a wall of text, but hopefully it will help you review what we learned in this video. Routers store information about destinations they know in their routing table. It’s like a switch’s MAC address table, but of course it functions differently. And when they receive packets, they look in the routing table to find the best route to forward the packet. Each route in the routing table is an instruction. A route says, to reach destinations in network X, send the packet to next-hop Y, which is the next router in the path to the destination. Now, on most routers they will have lots of routes like this. To reach destination X, send packets to next-hop Y. However, in this video we didn’t actually look at this kind of route. We looked at connected and local routes. Connected routes say: if the destination is directly connected to this router, send the packet directly to the destination Or, if the destination is your own IP address, receive the packet for yourself. This is how a Local route works. Anyway, the point is that the routing table is a set of instructions for the router, telling it how to forward packets. In the next video we will look at how next-hops work when we learn about static routes. When you configure an IP address on an interface and enable the interface, two routes are automatically added to the routing table. The first is a connected route, indicated with code C in the routing table. It is a route to the network connected to the interface. For example, if the interface’s IP is 192.168.1.1/24, the connected route will be to 1.0/24. I’m repeating the point above, but it tells the router: to send a packet to a destination in this network, send it out of the interface specified in the route. Then, the other kind of route is a Local route, indicated by code L in the routing table. It’s a route to the exact IP address configured on the interface. So, if the interface’s IP is 192.168.1.1/24, the route will be to 1.1/32. A /32 netmask is used to specify just the one IP address. This tells the router, packets to this destination are for you, and you should receive them for yourself, not forward them. Okay, we also talked about how routes ‘match’ destinations. A route matches a destination if the packet’s destination IP address is part of the network specified in the route. For example, a packet to 192.168.1.60 is matched by a route to 1.0/24, but not by a route to 0.0/24. Now, if a router receives a packet and it doesn’t have a route that matches the packet’s destination, it will drop the packet. This is different than switches, which flood frames if they don’t have a MAC table entry for the destination. Final point: if a router receives a packet and it has multiple routes that match the packet’s destination, it will use the ‘most specific’ matching route to forward the packet. And the most specific matching route means the matching route with the longest prefix length. This is different than switches, which look for an exact match in the MAC address table to forward frames. The frame’s destination MAC address must be the exact same as the entry in the MAC address table. There’s no concept of ‘most specific match’ in switches. Okay, so that was a summary of this video, hopefully it helps you review what you learned in this video, because this is important fundamental information. And here are the general topics we covered in this video. I introduced the concept of routing, the process routers use to determine the path that IP packets should take over a network. We examined the routing table on a Cisco router, specifically looking at Connected and Local routes which are automatically added to the routing table when you configure an IP address on an interface. And we also looked at routing fundamentals, how routers select which route to use to forward a particular packet. They do that by looking for the most specific matching route in the routing table. Now, there’s still lots more to cover about routing, and in the next video we’ll dig deeper into the topic by looking at static routes. Okay, now let’s move on to the quiz to test your understanding of the concepts we covered in this video. Here’s quiz question 1. The IP address configured on a router interface will appear in the routing table as what kind of route? Pause the video now to select the best answer. Okay, the answer is C, local. When you configure an IP address on an interface, two routes are automatically added to the router’s routing table, assuming the interface is enabled. Note that if the interface is shut down, the routes won’t appear. Anyway, the routes that are automatically added are a connected route, to the network, and a local route, to the exact IP address configured on the router interface. Okay, let’s go to question 2. Examine R1’s routing table. What will it do when it receives a packet destined for 192.168.3.25? Pause the video now to examine R1’s routing table and select the best answer. Okay, the answer is B, it will receive the packet for itself. R1 has this local route to 192.168.3.25/32, which means that this IP address is configured on its G0/2 interface. So, packets destined for 3.25 are destined for R1 itself. Okay, let’s go to question 3. Which of the following statements about the behavior of routers and switches are true? (select two). Pause the video now to select the best answers. Okay, the answers are B and C. Switches flood frames with an unknown destination. Those are called unknown unicast frames. Routers, on the other hand, never flood packets. Instead of flooding packets with unknown destinations, the router simply drops them. Okay, let’s go to question 4. Which two types of routes are automatically added to the routing table when you configure an IP address on an interface and enable it? Pause the video now to select the best answer. Okay, the answer is A: C and L. As shown in the SHOW IP ROUTE output on the right, C stands for Connected and L stands for Local. These two routes are added when you configure an IP address on an interface and enable it. Okay, let’s go to question 5. Examine R1’s routing table below. If R1 receives a packet destined for 10.0.1.23, how many routes match that destination? And which is the most specific matching route? Pause the video now to examine the routing table and select the best answer. Okay, the answer is C. There are two matching routes: 10.0.1.0/24 and .23/32. And the most specific matching route is the route to .23/32, so that route will be selected. It’s a local route, so that means R1 will receive the packet for itself, it won’t forward it to another device. Okay, that’s all for the quiz and this video. I hope it was helpful, thanks for watching.