1 00:00:21,730 --> 00:00:23,870 Pedro sent me a question, 2 00:00:23,980 --> 00:00:25,920 Thanks Pedro for the question. 3 00:00:26,440 --> 00:00:30,700 Pedro asked, what is the purpose of the loopback interfaces? 4 00:00:30,700 --> 00:00:38,110 Now if you do a search in google you'll find all kinds of answers including that the loopback interface 5 00:00:38,140 --> 00:00:44,680 allows you to test connectivity to the 127 001 IP address. 6 00:00:44,680 --> 00:00:51,890 Now that may be true on a PC but on a Cisco device a loopback interface has an entirely different 7 00:00:51,920 --> 00:00:54,040 meaning. In this topology 8 00:00:54,040 --> 00:01:01,760 I've got three routers, router 1, router 2 and router 3 configured with this IP addresses. 9 00:01:01,780 --> 00:01:10,840 On router 2, show IP interface brief shows us that the router has IP addresses configured on the gigabit 10 00:01:10,840 --> 00:01:18,790 interfaces. So gigabit 00 01 and 02 have IP addresses. 11 00:01:18,790 --> 00:01:25,300 Now in this example, these are virtual routers but if they were physical routers and a cable got disconnected 12 00:01:25,330 --> 00:01:30,650 or got cut or broken in some way the interface would go down. 13 00:01:30,910 --> 00:01:38,920 The difference between a physical interface and a loopback interface, is a loopback interface is a logical 14 00:01:38,920 --> 00:01:42,620 interface on a router and you can create many of these. 15 00:01:42,670 --> 00:01:48,190 So notice as soon as I create that logical interface the interfaces come up. 16 00:01:48,190 --> 00:01:53,430 I can then give that interface an IP address such as this. 17 00:01:53,530 --> 00:01:57,070 Notice it's a slash 32 IP address. 18 00:01:57,070 --> 00:02:01,900 In other words, this is the only IP address on that interface. 19 00:02:01,900 --> 00:02:08,979 A loopback interface is a logical interface on a router that won't go down unless you manually shut 20 00:02:09,070 --> 00:02:10,680 the interface down. 21 00:02:10,750 --> 00:02:18,520 It typically only has one IP address but you could configure multiple IP addresses on that interface 22 00:02:18,520 --> 00:02:20,370 if you wanted to. 23 00:02:20,380 --> 00:02:26,620 The first advantage of a loopback interface is the interface doesn't go down unless you explicitly 24 00:02:26,620 --> 00:02:28,140 shut it down. 25 00:02:28,210 --> 00:02:33,290 So it's not like there's a cable that can be unplugged and then interface goes down. 26 00:02:33,340 --> 00:02:39,040 Now, why is that important when you telnet to a router, so let's say I'll telnet from router 1 to router 27 00:02:39,070 --> 00:02:40,210 2. 28 00:02:40,240 --> 00:02:48,630 I could telnet to one of the gigabit interfaces on the router so telnet 10.1.1.2, notice 29 00:02:48,640 --> 00:02:49,720 I can log in. 30 00:02:49,870 --> 00:02:54,120 So I'm now connected to router 2, I'll go back to router 1 31 00:02:54,460 --> 00:03:01,020 and then I'll telnet to the second IP address 10 122. 32 00:03:01,060 --> 00:03:01,890 Now that's fine, 33 00:03:02,140 --> 00:03:06,870 but firstly you need to remember which IP address is configured on which router 34 00:03:07,180 --> 00:03:16,510 and secondly if for some reason an interface went down so let's say the cable was disconnected rather 35 00:03:16,510 --> 00:03:23,380 than me shutting it down manually here you would have a problem telnetting back to that IP address 10 36 00:03:23,380 --> 00:03:27,210 112 because the interface has gone down. 37 00:03:27,220 --> 00:03:33,790 However, if you have the loopback IP address configured on the router and you advertise that loopback 38 00:03:33,850 --> 00:03:41,210 through a routing protocol such as OSPF, you can telnet to that loopback using this network or 39 00:03:41,380 --> 00:03:42,850 this network. 40 00:03:42,850 --> 00:03:49,490 So if one of the interfaces goes down it's not a problem because you can still reach the loopback interface. 41 00:03:49,530 --> 00:03:55,410 So at the moment on router 1, we can't ping the loopback of router 2 because it's not advertised 42 00:03:55,830 --> 00:03:57,070 in a routing protocol. 43 00:03:57,330 --> 00:04:00,900 So what I'll do here is enable EIGRP 44 00:04:03,500 --> 00:04:04,820 and I'll do something similar here 45 00:04:04,890 --> 00:04:05,860 so 46 00:04:07,850 --> 00:04:12,640 enable EIGRP in all interfaces and let's do the same thing 47 00:04:12,950 --> 00:04:19,600 on router 3. 48 00:04:19,750 --> 00:04:25,130 Now once the neighbor relationships have been established which I have done in this example, so show 49 00:04:25,130 --> 00:04:31,600 IP EIGRP neighbors, there's our neighbor relationship, router 1 can ping the loopback of router 2. 50 00:04:32,000 --> 00:04:43,490 So now I can telnet to the loopback of router 2 even though the WAN interface is down, notice gigabit 00 51 00:04:43,670 --> 00:04:45,230 is currently down. 52 00:04:45,860 --> 00:04:57,020 So by the same token, if we brought up that gigabit 00 interface but then shut gigabit 02 53 00:05:00,380 --> 00:05:02,690 my telnet session still continues. 54 00:05:02,690 --> 00:05:07,010 So I notice the telnet session stayed up that won't always happen in the real world. 55 00:05:07,010 --> 00:05:13,250 It depends how long the connection takes to establish but notice show IP interface brief. 56 00:05:13,250 --> 00:05:20,720 I'm still able to telnet to the loopback of router 2 from router 1 because the telnet traffic is 57 00:05:20,720 --> 00:05:31,540 using the alternate route. So it doesn't matter if interfaces go down or come up as long as I've got 58 00:05:31,550 --> 00:05:34,080 one route between router 1 and router 2. 59 00:05:34,550 --> 00:05:40,160 I can connect to the loopback and manage the router through the loopback interface. 60 00:05:40,170 --> 00:05:46,360 It's also a lot easier if you use a separate subnet for your management network. 61 00:05:46,440 --> 00:05:52,780 In this example, I'm just gonna keep it simple and create loopbacks with IP addresses, 62 00:05:52,920 --> 00:05:56,260 Quadruple 1, Quadruple 2 and Quadruple 3. 63 00:05:56,700 --> 00:06:07,950 So I'll simply create an IP address on router 1 with the loopback address and I'll do the same on router 3 64 00:06:12,590 --> 00:06:15,530 on router 1 show IP route. 65 00:06:15,800 --> 00:06:18,390 We have two routes to get to the loop of router 66 00:06:18,410 --> 00:06:23,020 2 and two routes to get to the loopback of router 3. 67 00:06:23,300 --> 00:06:30,560 So ping quadruple 3, telnet quadruple 3, telnet is not working. 68 00:06:30,560 --> 00:06:31,590 Let's have a look. 69 00:06:31,590 --> 00:06:36,220 So show run pipe begin VTY. 70 00:06:36,480 --> 00:06:46,860 Notice I've got transport input none, line VTY 04, transport input and I'll just say all, telnet 71 00:06:46,860 --> 00:06:48,180 again. 72 00:06:48,330 --> 00:06:50,930 We can log in to router 3. 73 00:06:51,050 --> 00:06:55,580 So from a management point of view, it's a lot easier to use loopbacks. 74 00:06:55,910 --> 00:06:58,800 Now you might not wanna do it the way I've done it here in the real world. 75 00:06:58,970 --> 00:07:04,220 You might have a separate network that you use for management. 76 00:07:04,220 --> 00:07:09,670 So in this example I'll just use 192 network 77 00:07:09,920 --> 00:07:13,970 and actually what I'll do is I'll create a separate loopback. 78 00:07:14,060 --> 00:07:24,900 So I'll put this back to quadruple 2 and create a additional loopback for 192 168 1.2. 79 00:07:25,370 --> 00:07:28,440 So I could do something like this to make it consistent. 80 00:07:28,550 --> 00:07:34,850 So use interface loopback 192 it's always good practice to keep it simple. 81 00:07:36,230 --> 00:07:38,970 So use the same loopback number. 82 00:07:39,030 --> 00:07:40,740 Don't do what I've done here. 83 00:07:40,740 --> 00:07:42,340 Try and keep them consistent. 84 00:07:43,340 --> 00:07:44,510 So let's change that 85 00:07:44,510 --> 00:07:46,000 no interface. 86 00:07:46,350 --> 00:07:53,120 Loopback 1, interface loopback 192. Notice however it's very easy to create loopback interfaces 87 00:07:54,110 --> 00:07:55,370 just create as many as you like 88 00:08:00,930 --> 00:08:03,680 there are normally some kind of limitation on the router. 89 00:08:03,890 --> 00:08:05,920 But notice the numbers that we could use here 90 00:08:05,960 --> 00:08:14,740 you could use really long numbers if you wanted to but in this example I'll just keep it simple and 91 00:08:14,740 --> 00:08:15,510 use 192. 92 00:08:15,520 --> 00:08:17,540 So show IP route, 93 00:08:18,160 --> 00:08:25,060 we've now learnt the routes of the loopbacks and now all I need to remember is that when I telnet to 94 00:08:25,060 --> 00:08:32,830 router 2 it's 192 168 1 dot and the router which is dot 2. When I wanna telnet to router 3 95 00:08:32,830 --> 00:08:40,450 it's 192 168 1 dot router 3, so telnet 192 168 1.3 96 00:08:40,919 --> 00:08:42,049 and I can log in. 97 00:08:42,490 --> 00:08:50,660 So that's the first reason Pedro for using loopback interfaces. I'll cover another reason in a separate 98 00:08:50,670 --> 00:08:50,990 blog.