1 00:00:09,270 --> 00:00:12,680 In this video we're going to discuss static routes. 2 00:00:12,780 --> 00:00:16,560 I've been asked a number of times about static routes. 3 00:00:16,560 --> 00:00:24,360 Are you able for example to have multiple static routes configured on a router? Are you able to have multiple 4 00:00:24,360 --> 00:00:27,720 default routes configured on a router? 5 00:00:27,760 --> 00:00:34,290 Can you mix default routes and static routes? What's the effect of all of the above? 6 00:00:35,400 --> 00:00:41,770 In this example, we're gonna configure static routes on router 1 and test connectivity to the loopback 7 00:00:41,790 --> 00:00:48,630 of router 5. We have router 2, router 3, and router 4 in the typology and they configured with 8 00:00:48,630 --> 00:00:56,830 different subnets. Router 2 is configured with IP address 10.1.1.2 on the interface, router 3 is configured 9 00:00:56,830 --> 00:01:06,660 with 10.1.2.2 on this interface and router 4 is configured as 10.1.3.2 on this interface or link. 10 00:01:06,730 --> 00:01:10,400 So here's router 1, 11 00:01:10,580 --> 00:01:11,450 What we're gonna test 12 00:01:11,480 --> 00:01:14,910 Is connectivity to the loopback of router 5. 13 00:01:14,980 --> 00:01:22,490 So from router 1, is it able to ping the loopback of router five? 14 00:01:22,720 --> 00:01:29,330 So at the moment when I ping the loopback out of router 5 we get timeouts. 15 00:01:29,790 --> 00:01:38,030 The router is not able to ping the loopback of router 5. Show IP route shows us the routing table. 16 00:01:38,560 --> 00:01:47,860 What you'll notice is that it only contains connected and local routes, there's no route to 5.5.5.5 17 00:01:48,300 --> 00:01:49,750 de-bug IP packet 18 00:01:49,750 --> 00:01:56,530 as an example will show us what happens when the router tries to ping that address. So I'm going to ping 19 00:01:56,530 --> 00:01:57,390 5.5. 20 00:01:57,400 --> 00:01:58,270 5.5. 21 00:01:58,300 --> 00:02:02,580 and repeat it once and let's see what the output looks like. 22 00:02:02,680 --> 00:02:07,540 Notice unroutable the router doesn't know where to route the packets. 23 00:02:08,710 --> 00:02:12,320 And again that's because there's no route to the destination. 24 00:02:12,310 --> 00:02:16,240 There's also no gateway of last resort set on the router 25 00:02:16,600 --> 00:02:22,350 So it has no way to get to this IP address. 26 00:02:22,810 --> 00:02:26,470 We could configure a route as follows. 27 00:02:26,470 --> 00:02:38,110 So an exact match on the route and point it to 10.1.1.2 which is router 2. Show IP 28 00:02:38,120 --> 00:02:42,880 route now shows us that route in the routing table. 29 00:02:43,000 --> 00:02:46,160 So can this router ping the loopback of router 5? 30 00:02:46,240 --> 00:02:49,540 And the answer is yes it can. 31 00:02:49,540 --> 00:02:55,070 I'm going to disable IP domain look-up here to speed up traceroute. 32 00:02:55,090 --> 00:02:58,270 So let's trace to the loopback of router 5. 33 00:02:58,390 --> 00:03:06,170 Notice it's going via 10.1.1.2 which is router 2 and then it gets to router 5. 34 00:03:06,220 --> 00:03:17,990 What happens if I configure a static route like this and pointed it to router 3? Which way will 35 00:03:17,990 --> 00:03:18,970 the traffic go? 36 00:03:20,360 --> 00:03:21,960 So let's have a look at the routing table. 37 00:03:21,980 --> 00:03:25,930 Show IP route shows us two entries in the routing table. 38 00:03:26,030 --> 00:03:30,630 There are two ways to get to the loopback of router 5. 39 00:03:31,070 --> 00:03:38,170 So if I trace to that loopback notice it's still going via router 2. 40 00:03:38,330 --> 00:03:41,270 In other words it's going to 10.1.1.1 41 00:03:41,270 --> 00:03:52,520 and the reason for that is because this entry is more specific than this entry. Routers when deciding 42 00:03:52,520 --> 00:03:53,620 where to route traffic 43 00:03:53,630 --> 00:04:00,430 look at the longest match of a route. This route is a 32-bit match 44 00:04:00,760 --> 00:04:02,920 this is a 24-bit match. 45 00:04:03,280 --> 00:04:07,530 So the traffic's gonna go via 10.1.1.2 46 00:04:07,910 --> 00:04:16,540 and we can prove that by doing a traceroute if we remove this route from the routing table 47 00:04:19,779 --> 00:04:31,840 and then do a trace again notice the traceroute is going via 10.1.1.2 but that's because we only have 48 00:04:31,840 --> 00:04:34,270 this route in the routing table. 49 00:04:34,270 --> 00:04:39,220 If we created another static route like this 50 00:04:42,860 --> 00:04:45,110 via router 4 51 00:04:47,960 --> 00:04:55,660 which way will the traffic go? So show IP route shows us the two entries we've got a /16 52 00:04:55,670 --> 00:04:56,650 /24. 53 00:04:56,930 --> 00:05:06,270 So when we trace to router 5 notice it's going via router 3 because this is a longer match. 54 00:05:06,480 --> 00:05:10,390 That is a longer match than this. 55 00:05:10,650 --> 00:05:16,340 So router 3 is preferred rather than router 4. 56 00:05:16,470 --> 00:05:19,170 But again if we removed 57 00:05:22,000 --> 00:05:25,540 that route from the routing table so I'm gonna remove this entry. 58 00:05:30,770 --> 00:05:32,080 So remove the static route 59 00:05:35,460 --> 00:05:44,540 now when we look at the routing table we only have this entry so traffic will go via 10.1.3.2. 60 00:05:44,540 --> 00:05:47,180 In other words it's going to go via router 4. 61 00:05:50,890 --> 00:05:55,810 If I add a more specific product of let's say /24 62 00:05:59,120 --> 00:06:00,800 going via router 3 agian 63 00:06:03,650 --> 00:06:10,720 notice the traffic goes via router 3 64 00:06:10,940 --> 00:06:14,120 And if I use a more specific route such as this 65 00:06:18,730 --> 00:06:21,640 going via router 2 rather 66 00:06:25,310 --> 00:06:32,750 notice the traffic goes via router 2. Show IP route shows us those routes /28 route is 67 00:06:32,750 --> 00:06:39,170 more specific than a /24 route which is more specific than a /16 route. 68 00:06:39,330 --> 00:06:46,260 So remember with static routes and this applies to other routing protocols as well more specific matches 69 00:06:46,260 --> 00:06:47,940 win. 70 00:06:47,970 --> 00:06:53,520 So what happens if we add a route like this? 71 00:06:58,640 --> 00:07:05,080 Same mask as router 2 configure it to go to router 3. 72 00:07:05,300 --> 00:07:07,560 So show IP route, 73 00:07:07,670 --> 00:07:16,670 notice the difference in the routing table now we've got two entries for the same route. 74 00:07:16,750 --> 00:07:24,550 So when we trace to the loopback now notice its doing load balancing traffic is load balancing across 75 00:07:24,700 --> 00:07:34,260 both parts and that's because we've got two equal entries in the routing table. 76 00:07:34,290 --> 00:07:37,130 So show run pipe include route 77 00:07:40,120 --> 00:07:45,750 these two routes are going to be used for load balancing because they're the most specific and they're 78 00:07:45,750 --> 00:07:47,440 the same length. 79 00:07:47,470 --> 00:07:49,210 These two will be ignored 80 00:07:49,840 --> 00:07:53,380 but if we copy that and add an entry 81 00:07:56,580 --> 00:08:04,420 going to 10.1.3.2 for router 4 the routing table shows us three entries 82 00:08:04,420 --> 00:08:08,770 now. If we trace to the loopback 83 00:08:08,760 --> 00:08:14,310 now notice its going to load balance across those three routes. 84 00:08:14,540 --> 00:08:20,660 You need to be careful with this because sometimes depending on the router the load balancing may actually 85 00:08:20,660 --> 00:08:26,820 not be true but for CCNA level we assume that it load balances as follows. 86 00:08:27,150 --> 00:08:36,630 So show run pipe include route things to remember more specific entries win if there are multiple 87 00:08:36,630 --> 00:08:43,169 entries with the same route and same mask such as these three the routable load balance across those 88 00:08:43,169 --> 00:08:45,570 paths equally. 89 00:08:45,630 --> 00:08:53,980 So in other words equal-cost load balancing or load sharing. Hope you enjoyed this video if it was of benefit 90 00:08:53,980 --> 00:08:58,610 to you please like it and please subscribe to my YouTube channel. 91 00:08:58,630 --> 00:09:00,430 I wish you all the very best.