1 00:00:00,000 --> 00:00:02,844 [AUDIO LOGO] 2 00:00:02,844 --> 00:00:08,070 3 00:00:08,070 --> 00:00:10,830 So let's begin our journey here by taking 4 00:00:10,830 --> 00:00:13,860 a look at AS-Path Prepending. 5 00:00:13,860 --> 00:00:19,320 This is probably the most common and also the easiest way 6 00:00:19,320 --> 00:00:23,580 to influence the return traffic into your AS. 7 00:00:23,580 --> 00:00:28,350 You're simply adding ASes to the path to artificially make 8 00:00:28,350 --> 00:00:30,220 that AS path longer. 9 00:00:30,220 --> 00:00:34,710 And therefore, other devices that are sending traffic to you 10 00:00:34,710 --> 00:00:37,120 will not prefer that path. 11 00:00:37,120 --> 00:00:40,320 So this is actually a fairly easy implementation. 12 00:00:40,320 --> 00:00:43,110 Let's go ahead and take a look at our topology, 13 00:00:43,110 --> 00:00:44,850 get an idea of what we're going to do. 14 00:00:44,850 --> 00:00:46,830 And then we'll jump into the command line 15 00:00:46,830 --> 00:00:50,085 and see AS-Path Prepending in action. 16 00:00:50,085 --> 00:00:52,800 17 00:00:52,800 --> 00:00:55,560 So for the demonstrations in this skill, 18 00:00:55,560 --> 00:00:59,390 we will be using BGP topology 1 if you want 19 00:00:59,390 --> 00:01:01,770 to have that diagram handy. 20 00:01:01,770 --> 00:01:04,410 And for this particular demonstration, 21 00:01:04,410 --> 00:01:08,660 we're going to be taking a look at AS 300 22 00:01:08,660 --> 00:01:13,970 and its return path coming to AS 100. 23 00:01:13,970 --> 00:01:16,730 So what should be happening right now 24 00:01:16,730 --> 00:01:19,730 is router 9 should actually be sending 25 00:01:19,730 --> 00:01:22,478 all of the traffic to router 1. 26 00:01:22,478 --> 00:01:24,020 What we're going to do is we're going 27 00:01:24,020 --> 00:01:30,560 to have router 1 prepend its AS number a few times when sending 28 00:01:30,560 --> 00:01:32,720 its updates to router 9. 29 00:01:32,720 --> 00:01:35,270 And what we'll see is this will cause 30 00:01:35,270 --> 00:01:38,750 router 9 to flip over and start sending the traffic 31 00:01:38,750 --> 00:01:40,520 to router 2. 32 00:01:40,520 --> 00:01:45,800 Now, what makes this inbound path selection is the fact 33 00:01:45,800 --> 00:01:49,400 that we're going to make this configuration change on router 34 00:01:49,400 --> 00:01:50,270 1. 35 00:01:50,270 --> 00:01:57,350 So it's AS 100 that's going to be influencing as 300. 36 00:01:57,350 --> 00:02:00,420 So let's jump into the command line and get started. 37 00:02:00,420 --> 00:02:07,460 We'll begin actually on router 9 to examine its current routes. 38 00:02:07,460 --> 00:02:09,580 So again, let's start by verifying that route. 39 00:02:09,580 --> 00:02:12,280 We'll just do a show ip bgp. 40 00:02:12,280 --> 00:02:14,500 And what we're seeing here is all 41 00:02:14,500 --> 00:02:17,950 of the routes coming from AS 100 are currently 42 00:02:17,950 --> 00:02:20,020 going through router 1. 43 00:02:20,020 --> 00:02:22,340 So we see that there's numerous routes here. 44 00:02:22,340 --> 00:02:24,190 But just to highlight two of them, 45 00:02:24,190 --> 00:02:30,070 we see these first two entries with the next hop of 50.1.19.1 46 00:02:30,070 --> 00:02:32,650 being selected as the best. 47 00:02:32,650 --> 00:02:35,600 And we see that's the same for all of the entries. 48 00:02:35,600 --> 00:02:40,370 So let's go ahead and implement our policy on router 1. 49 00:02:40,370 --> 00:02:43,310 This is a fairly straightforward policy. 50 00:02:43,310 --> 00:02:46,320 We're just going to make a route policy. 51 00:02:46,320 --> 00:02:50,690 We'll call it RP_TO_AS300. 52 00:02:50,690 --> 00:02:54,200 Now, we could of course here use a prefixed 53 00:02:54,200 --> 00:02:57,050 set, as we've done numerous times before, 54 00:02:57,050 --> 00:02:59,570 just to match on certain prefixes. 55 00:02:59,570 --> 00:03:02,240 But in this case, our design goal 56 00:03:02,240 --> 00:03:09,200 was to have all of the traffic returning from AS 300 to AS 100 57 00:03:09,200 --> 00:03:11,180 to come in through router 2. 58 00:03:11,180 --> 00:03:13,010 So in this case, we're going to do this 59 00:03:13,010 --> 00:03:15,360 without specifying the prefixes. 60 00:03:15,360 --> 00:03:17,840 So this will just apply to all of them. 61 00:03:17,840 --> 00:03:21,360 Just keep that in mind as we're writing our policy here. 62 00:03:21,360 --> 00:03:23,840 So without any kind of policy statement, 63 00:03:23,840 --> 00:03:26,570 all we're going to have to say is that we 64 00:03:26,570 --> 00:03:30,360 want to pretend the AS path. 65 00:03:30,360 --> 00:03:33,950 And we see here, we can actually put in any numbers we want. 66 00:03:33,950 --> 00:03:37,400 Technically, you don't have to use your own AS number. 67 00:03:37,400 --> 00:03:41,330 But since own AS is the most common thing to do, 68 00:03:41,330 --> 00:03:43,500 we actually have a special setting for that. 69 00:03:43,500 --> 00:03:45,410 We can just say own-as. 70 00:03:45,410 --> 00:03:48,590 And then we can tell it how many times. 71 00:03:48,590 --> 00:03:51,710 In this case, we'll just go ahead and do 2, 72 00:03:51,710 --> 00:03:54,230 like I had put on our diagram. 73 00:03:54,230 --> 00:03:56,840 Once it's done prepending the path, 74 00:03:56,840 --> 00:04:00,500 then we simply want it to pass the routes through. 75 00:04:00,500 --> 00:04:04,700 We'll end our policy, go into BGP, 76 00:04:04,700 --> 00:04:08,270 go to the neighbor configuration for router 9, 77 00:04:08,270 --> 00:04:12,830 into the address family, and apply our route policy. 78 00:04:12,830 --> 00:04:14,990 This will be an outbound policy because this 79 00:04:14,990 --> 00:04:17,730 is what we're going to be sending to our neighbors. 80 00:04:17,730 --> 00:04:19,440 So this is ready to go. 81 00:04:19,440 --> 00:04:21,380 But before we do it, we want to see 82 00:04:21,380 --> 00:04:24,800 what the update looks like in Wireshark when we actually 83 00:04:24,800 --> 00:04:26,010 implement this. 84 00:04:26,010 --> 00:04:29,360 So let's jump into Wireshark, set up a capture 85 00:04:29,360 --> 00:04:32,750 before we actually commit this change and router 1 86 00:04:32,750 --> 00:04:35,140 sends its update. 87 00:04:35,140 --> 00:04:38,730 So here, we have our capture running on router 1's gigabit 2 88 00:04:38,730 --> 00:04:44,860 interface looking for any BGP traffic other than keepalives. 89 00:04:44,860 --> 00:04:47,730 So now, let's jump back over to our command line 90 00:04:47,730 --> 00:04:49,990 and commit our changes. 91 00:04:49,990 --> 00:04:52,050 So we'll simply say commit. 92 00:04:52,050 --> 00:04:54,700 We'll exit configuration mode. 93 00:04:54,700 --> 00:05:01,410 And let's go ahead and do a show bgp neighbor for router 9. 94 00:05:01,410 --> 00:05:04,200 And let's do an advertised routes. 95 00:05:04,200 --> 00:05:07,300 We can see here on the AS path where we're 96 00:05:07,300 --> 00:05:10,750 prepending our AS two times. 97 00:05:10,750 --> 00:05:13,260 So that's a total of three. . 98 00:05:13,260 --> 00:05:17,040 Remember one of these is the AS that gets put on automatically 99 00:05:17,040 --> 00:05:21,060 on EBGP updates and then the two ASes that we're 100 00:05:21,060 --> 00:05:23,290 adding through our policy. 101 00:05:23,290 --> 00:05:25,020 So now, of course, we want to take a look 102 00:05:25,020 --> 00:05:28,410 at what this looks like in Wireshark and then hop over 103 00:05:28,410 --> 00:05:30,390 and make sure that it made the change we 104 00:05:30,390 --> 00:05:34,040 wanted it to make on router 9. 105 00:05:34,040 --> 00:05:36,590 So back here in Wireshark, I did have 106 00:05:36,590 --> 00:05:40,160 to modify our filter here just a little bit because it 107 00:05:40,160 --> 00:05:43,880 sent a keepalive at the same time as the update messages. 108 00:05:43,880 --> 00:05:46,410 And it ended up matching our filter. 109 00:05:46,410 --> 00:05:48,650 So I did have to take that part of our filter off 110 00:05:48,650 --> 00:05:49,910 to be able to see this. 111 00:05:49,910 --> 00:05:55,670 But here, we can see this message coming from 50.1.19.1 112 00:05:55,670 --> 00:05:59,450 going to router 9, the 50.1.19.9. 113 00:05:59,450 --> 00:06:03,350 And if we look down here and expand the UPDATE Message 114 00:06:03,350 --> 00:06:07,310 and the Path Attributes, we can see here under the Path 115 00:06:07,310 --> 00:06:15,010 Attribute that the AS path is 100 100 100 1,000. 116 00:06:15,010 --> 00:06:18,550 So once again, 3 copies, one that's 117 00:06:18,550 --> 00:06:21,950 normal for EBGP and then the two that, of course, 118 00:06:21,950 --> 00:06:23,710 we're adding through our policy. 119 00:06:23,710 --> 00:06:26,170 Now, let's jump over to router 9 and see 120 00:06:26,170 --> 00:06:30,540 if this actually made the change that we wanted it to make. 121 00:06:30,540 --> 00:06:34,640 So on router 9, we'll simply do our show ip bgp again. 122 00:06:34,640 --> 00:06:37,160 And there's a few things here we can see. 123 00:06:37,160 --> 00:06:40,340 And in this case, we'll just focus on the first entry, 124 00:06:40,340 --> 00:06:44,060 the 100..8.8.0/24. 125 00:06:44,060 --> 00:06:47,090 And in this case, we can see that now it's 126 00:06:47,090 --> 00:06:52,700 choosing router 2 as the next hop, the 50.1.29.2, 127 00:06:52,700 --> 00:06:57,170 with the shorter AS path that's only 100. 128 00:06:57,170 --> 00:07:00,020 We can also see that the path through router 1 129 00:07:00,020 --> 00:07:03,440 has in fact been prepended with those three ASes 130 00:07:03,440 --> 00:07:08,120 in the AS path, which is why router 9 is no longer choosing 131 00:07:08,120 --> 00:07:09,560 these as best. 132 00:07:09,560 --> 00:07:11,780 And therefore, we can see that local preference 133 00:07:11,780 --> 00:07:16,800 is doing exactly what it's designed to do. 134 00:07:16,800 --> 00:07:20,280 In this video, we took a detailed look 135 00:07:20,280 --> 00:07:23,760 at how AS-Path Prepending can actually 136 00:07:23,760 --> 00:07:29,350 be used to influence our return, or our inbound traffic, 137 00:07:29,350 --> 00:07:31,470 depending on how you want to look at it. 138 00:07:31,470 --> 00:07:36,330 The way we did this was by adding ASes to the AS path 139 00:07:36,330 --> 00:07:39,900 going out of router 1 towards router 9, 140 00:07:39,900 --> 00:07:45,120 therefore making that path not look as desirable as the path 141 00:07:45,120 --> 00:07:48,910 that we wanted it to use going through router 2. 142 00:07:48,910 --> 00:07:51,570 So again, the basic idea here is we're 143 00:07:51,570 --> 00:07:56,260 tainting the path that we don't want the other devices to use. 144 00:07:56,260 --> 00:08:01,500 Now, keep in mind just like any other inbound influencing, 145 00:08:01,500 --> 00:08:06,000 this could easily be overridden on router 9 146 00:08:06,000 --> 00:08:09,450 if they chose to by implementing either weight 147 00:08:09,450 --> 00:08:11,760 or local preference because those 148 00:08:11,760 --> 00:08:14,130 are higher on the BGP path selection 149 00:08:14,130 --> 00:08:18,090 criteria than shortest AS path. 150 00:08:18,090 --> 00:08:20,310 I hope this has been informative for you, 151 00:08:20,310 --> 00:08:23,480 and I'd like to thank you for viewing. 152 00:08:23,480 --> 00:08:27,000