1 00:00:00,000 --> 00:00:03,880 [AUDIO LOGO] 2 00:00:03,880 --> 00:00:08,260 3 00:00:08,260 --> 00:00:10,930 To wrap up this section, let's take a look 4 00:00:10,930 --> 00:00:14,080 at some of the advanced features of RPL. 5 00:00:14,080 --> 00:00:18,100 We'll look at things like nesting, parameterization, 6 00:00:18,100 --> 00:00:21,250 and creating and configuring sets that we 7 00:00:21,250 --> 00:00:23,210 can use in our policies. 8 00:00:23,210 --> 00:00:25,030 So we'll look at a couple of things here. 9 00:00:25,030 --> 00:00:26,980 We'll also jump on to the command line, just 10 00:00:26,980 --> 00:00:30,790 a little bit, and take a look at things like editing our policy 11 00:00:30,790 --> 00:00:32,119 once it's been written. 12 00:00:32,119 --> 00:00:35,020 So let's jump in and take a look at some of these details. 13 00:00:35,020 --> 00:00:38,260 And then, again, we'll wrap up by looking at some verification 14 00:00:38,260 --> 00:00:41,210 and editing commands. 15 00:00:41,210 --> 00:00:44,200 So let's start off by talking about nesting. 16 00:00:44,200 --> 00:00:48,580 So we do have basically two ways of doing some advanced nesting 17 00:00:48,580 --> 00:00:49,270 here. 18 00:00:49,270 --> 00:00:52,390 First, is we can have nested policies. 19 00:00:52,390 --> 00:00:55,090 In this example, what we're doing is 20 00:00:55,090 --> 00:00:56,690 we're writing two different policies. 21 00:00:56,690 --> 00:01:02,660 One is called RP_SET_MED, the other is called RP_AS_PATH. 22 00:01:02,660 --> 00:01:05,850 And then we have another policy, in this case, 23 00:01:05,850 --> 00:01:07,880 we're just calling it RP_PARENT. 24 00:01:07,880 --> 00:01:09,590 And you can see what we're doing here 25 00:01:09,590 --> 00:01:13,760 is we're applying these other two policies, which 26 00:01:13,760 --> 00:01:15,890 means that whatever these are set to do 27 00:01:15,890 --> 00:01:19,950 are going to be done in this policy down here. 28 00:01:19,950 --> 00:01:23,120 So this is simply nesting policies. 29 00:01:23,120 --> 00:01:27,020 We can also nest If statements. 30 00:01:27,020 --> 00:01:29,400 This one's actually a little bit easier. 31 00:01:29,400 --> 00:01:31,280 We simply have an If statement that 32 00:01:31,280 --> 00:01:36,080 says, for example, if the med equals 100, then 33 00:01:36,080 --> 00:01:39,920 if the local preference is greater than or equal to 200, 34 00:01:39,920 --> 00:01:44,120 then set the community to 100:200 35 00:01:44,120 --> 00:01:46,460 and we're doing it additively. 36 00:01:46,460 --> 00:01:48,650 But we're simply saying, essentially, 37 00:01:48,650 --> 00:01:52,370 if this and this, then do this. 38 00:01:52,370 --> 00:01:56,500 That's essentially what this is saying. 39 00:01:56,500 --> 00:02:00,820 The next feature we want to look at is parameterization. 40 00:02:00,820 --> 00:02:03,320 This can be set in one of two ways. 41 00:02:03,320 --> 00:02:06,430 The first of which is globally. 42 00:02:06,430 --> 00:02:11,110 And the way this works is we use this special policy 43 00:02:11,110 --> 00:02:13,780 called policy global. 44 00:02:13,780 --> 00:02:16,900 Under this, we then create entries 45 00:02:16,900 --> 00:02:22,340 with values that are separated by commas, 46 00:02:22,340 --> 00:02:25,310 and we can just simply put in multiple entries. 47 00:02:25,310 --> 00:02:29,080 So, essentially, we're defining variables. 48 00:02:29,080 --> 00:02:32,050 Once we've defined everything that we want to, 49 00:02:32,050 --> 00:02:37,390 we then simply say end global to exit that configuration mode. 50 00:02:37,390 --> 00:02:39,970 Then we write our policy. 51 00:02:39,970 --> 00:02:43,480 In this case, we're doing something called RP_SET_MED. 52 00:02:43,480 --> 00:02:49,493 And we're simply saying, if the AS path originates from AS, 53 00:02:49,493 --> 00:02:51,160 and you can see the way we call to this? 54 00:02:51,160 --> 00:02:55,180 Is we put them in single quotes, and we use dollar sign, 55 00:02:55,180 --> 00:02:59,650 and then we call to the global parameter that we set. 56 00:02:59,650 --> 00:03:04,240 And it'll then take this value, in this case, a 65001 57 00:03:04,240 --> 00:03:06,760 and plug it into the statement there. 58 00:03:06,760 --> 00:03:12,730 Then we say to set the Med to DF_MED. 59 00:03:12,730 --> 00:03:15,790 This, of course, matches this parameter. 60 00:03:15,790 --> 00:03:20,240 So it's going to take the 300, and plug it in down here. 61 00:03:20,240 --> 00:03:24,070 So this is how we set these parameters globally. 62 00:03:24,070 --> 00:03:27,670 Again, very much like using variables. 63 00:03:27,670 --> 00:03:29,750 The big advantage to this, of course, 64 00:03:29,750 --> 00:03:33,400 is we only have to configure these parameters once globally, 65 00:03:33,400 --> 00:03:36,400 and then we can call to them from as many policies 66 00:03:36,400 --> 00:03:37,810 as we need to write. 67 00:03:37,810 --> 00:03:42,110 So we can reuse these as many times as we need to. 68 00:03:42,110 --> 00:03:44,350 The other choice is that they can 69 00:03:44,350 --> 00:03:48,080 be passed into a nested policy. 70 00:03:48,080 --> 00:03:50,990 So let's take a look at this example. 71 00:03:50,990 --> 00:03:55,030 So here we have a policy called RP_SET_MED. 72 00:03:55,030 --> 00:04:03,700 And this is looking to receive two parameters, $MED and $AS. 73 00:04:03,700 --> 00:04:06,730 Now, these parameters are going to be passed 74 00:04:06,730 --> 00:04:10,150 into these parts of the policy. 75 00:04:10,150 --> 00:04:14,960 The way those values are sent in is shown here at the bottom. 76 00:04:14,960 --> 00:04:18,339 So here we have a policy called RP_UPDATES, 77 00:04:18,339 --> 00:04:22,270 and it's got some If statements, but then look what it's doing. 78 00:04:22,270 --> 00:04:27,310 It seemed to apply the RP_SET_MED, 79 00:04:27,310 --> 00:04:34,180 and it's specifying the value for Med, and the value for AS. 80 00:04:34,180 --> 00:04:39,700 So these values are then passed into these parameters 81 00:04:39,700 --> 00:04:42,920 and used in the policy shown at the top. 82 00:04:42,920 --> 00:04:45,280 We also have an else If down here 83 00:04:45,280 --> 00:04:49,810 where we call to the same policy and set different parameters 84 00:04:49,810 --> 00:04:50,900 to it. 85 00:04:50,900 --> 00:04:53,320 So when the policy gets called here, 86 00:04:53,320 --> 00:04:56,300 it's going to be sent different values. 87 00:04:56,300 --> 00:05:00,040 So this is how the parameters can be passed from a parent 88 00:05:00,040 --> 00:05:03,400 policy into a nested policy. 89 00:05:03,400 --> 00:05:06,610 Next let's take a look at value sets. 90 00:05:06,610 --> 00:05:10,400 These can either be inline or named. 91 00:05:10,400 --> 00:05:15,020 We have five different types of named sets that are available. 92 00:05:15,020 --> 00:05:19,210 We have an AS-path set, a community set, 93 00:05:19,210 --> 00:05:23,350 an extended community set, prefix set, and a route 94 00:05:23,350 --> 00:05:25,130 distinguisher your set. 95 00:05:25,130 --> 00:05:26,920 These are the things that are available. 96 00:05:26,920 --> 00:05:29,590 We'll be looking at these in a little bit more detail 97 00:05:29,590 --> 00:05:31,460 in just a moment. 98 00:05:31,460 --> 00:05:33,530 But first, let's look at some examples. 99 00:05:33,530 --> 00:05:37,360 So here we have an inline example where we're simply 100 00:05:37,360 --> 00:05:41,620 saying if the attribute is in, and then 101 00:05:41,620 --> 00:05:44,690 we simply list out multiple values. 102 00:05:44,690 --> 00:05:47,800 So we're defining the set right here. 103 00:05:47,800 --> 00:05:49,190 That is the set. 104 00:05:49,190 --> 00:05:51,790 So if whatever it is we're looking for 105 00:05:51,790 --> 00:05:55,240 is in any of these values, then do whatever. 106 00:05:55,240 --> 00:05:56,540 Very, very simple. 107 00:05:56,540 --> 00:06:00,430 We're defining a set right there on the If statement. 108 00:06:00,430 --> 00:06:04,330 More commonly what we will do is actually create 109 00:06:04,330 --> 00:06:06,830 some form of a named set. 110 00:06:06,830 --> 00:06:09,250 Now, first, let's just reference our little note here 111 00:06:09,250 --> 00:06:12,160 that the x set over here on the left 112 00:06:12,160 --> 00:06:15,550 is referring to one of those types of sets 113 00:06:15,550 --> 00:06:18,200 that we talked about as already being available. 114 00:06:18,200 --> 00:06:21,220 So an AS-path set, community set, extended community set, 115 00:06:21,220 --> 00:06:25,190 prefix set, or a route distinguisher set or RD set. 116 00:06:25,190 --> 00:06:28,190 So we're simply not showing an example of all of them, 117 00:06:28,190 --> 00:06:30,940 but they all have the same basic formatting. 118 00:06:30,940 --> 00:06:32,560 After you define the type, you then 119 00:06:32,560 --> 00:06:35,260 give it a name of some sort, and then you 120 00:06:35,260 --> 00:06:38,590 list the different values, separated, again, 121 00:06:38,590 --> 00:06:41,650 by commas at the end of each line. 122 00:06:41,650 --> 00:06:45,460 You then say end set to exit set configuration. 123 00:06:45,460 --> 00:06:48,070 Then when we want to use this, we simply 124 00:06:48,070 --> 00:06:49,705 call to it by its name. 125 00:06:49,705 --> 00:06:52,248 126 00:06:52,248 --> 00:06:53,790 So let's talk a little bit about some 127 00:06:53,790 --> 00:06:55,710 of the different types of sets. 128 00:06:55,710 --> 00:06:58,680 We'll start with the AS path set. 129 00:06:58,680 --> 00:07:03,790 Essentially, we can use either an IOS regular expression. 130 00:07:03,790 --> 00:07:07,180 We can use a DFA regular expression, 131 00:07:07,180 --> 00:07:11,400 which is the deterministic finite automa or automation. 132 00:07:11,400 --> 00:07:15,070 This isn't used very commonly, at least not in my experience, 133 00:07:15,070 --> 00:07:17,110 but it is another option. 134 00:07:17,110 --> 00:07:20,800 This can use the neighbor-is statement, 135 00:07:20,800 --> 00:07:25,570 originates-from statement, passes-through statement, 136 00:07:25,570 --> 00:07:27,560 or the length statement. 137 00:07:27,560 --> 00:07:29,770 So quite a few different options we 138 00:07:29,770 --> 00:07:32,455 have here when trying to match on the AS. 139 00:07:32,455 --> 00:07:36,100 Of course, a very, very common one 140 00:07:36,100 --> 00:07:41,590 is the IOS regex where we use regular expressions to match 141 00:07:41,590 --> 00:07:44,670 on our AS path sets. 142 00:07:44,670 --> 00:07:47,580 Community and extended community sets 143 00:07:47,580 --> 00:07:51,900 can also use IOS regular expressions, the DFA 144 00:07:51,900 --> 00:07:59,250 regular expressions, except its own, internet, local AS, 145 00:07:59,250 --> 00:08:04,830 no advertise, no export or private AS, 146 00:08:04,830 --> 00:08:08,650 which of course, would include the private AS range. 147 00:08:08,650 --> 00:08:11,460 So those are the options for both community and extended 148 00:08:11,460 --> 00:08:13,050 community sets. 149 00:08:13,050 --> 00:08:16,080 Now, when you're actually matching on those, 150 00:08:16,080 --> 00:08:18,270 we have different types of matching. 151 00:08:18,270 --> 00:08:22,140 You can do a match-any, a match-every, 152 00:08:22,140 --> 00:08:24,180 which of course, is an all. 153 00:08:24,180 --> 00:08:26,310 Any would be an or. 154 00:08:26,310 --> 00:08:30,300 You can also do a matches-within, which 155 00:08:30,300 --> 00:08:32,490 means all the communities on the routes 156 00:08:32,490 --> 00:08:34,620 have to be within the match element, 157 00:08:34,620 --> 00:08:37,260 but they don't have to be an exact match. 158 00:08:37,260 --> 00:08:40,179 Finally, we have prefix sets. 159 00:08:40,179 --> 00:08:43,919 These are almost the same as prefix-lists. 160 00:08:43,919 --> 00:08:46,080 However, in addition to supporting less than 161 00:08:46,080 --> 00:08:48,390 or equal to and greater than or equal to, 162 00:08:48,390 --> 00:08:54,930 these also support equals, which as we know prefix lists do not. 163 00:08:54,930 --> 00:08:56,700 So the last thing we want to look at 164 00:08:56,700 --> 00:09:00,510 is actually editing an existing policy. 165 00:09:00,510 --> 00:09:02,550 Now, the interesting thing with this 166 00:09:02,550 --> 00:09:05,460 is if you go into configuration mode 167 00:09:05,460 --> 00:09:07,470 and you actually go into a policy 168 00:09:07,470 --> 00:09:11,850 that you've already written, it will delete that policy 169 00:09:11,850 --> 00:09:13,980 and you'll have to rewrite it. 170 00:09:13,980 --> 00:09:16,860 It overwrites the existing policy. 171 00:09:16,860 --> 00:09:20,860 So clearly, this is not a really good editing tool. 172 00:09:20,860 --> 00:09:24,270 So this, of course, can be done but you're 173 00:09:24,270 --> 00:09:27,120 going to be re-entering the entire policy. 174 00:09:27,120 --> 00:09:30,300 Now, if you have that policy in something like a text editor 175 00:09:30,300 --> 00:09:33,070 and you're just pasting it back in, 176 00:09:33,070 --> 00:09:35,380 well that's really not a big deal. 177 00:09:35,380 --> 00:09:39,540 But if you're just writing the policy manually on the CLI, 178 00:09:39,540 --> 00:09:41,830 that could, of course, be an issue. 179 00:09:41,830 --> 00:09:46,030 So instead, what we want to do is actually edit the list. 180 00:09:46,030 --> 00:09:47,830 So the best way to do this. 181 00:09:47,830 --> 00:09:49,440 Let's jump over to the command line, 182 00:09:49,440 --> 00:09:53,290 and take a look at how to edit an existing policy. 183 00:09:53,290 --> 00:09:55,290 So we'll just do this here on router 1. 184 00:09:55,290 --> 00:09:57,690 Let's start off with a show RPO. 185 00:09:57,690 --> 00:10:00,330 And we can see that this already has a policy. 186 00:10:00,330 --> 00:10:02,820 It's simply called all, and all it's doing 187 00:10:02,820 --> 00:10:04,570 is passing all the routes. 188 00:10:04,570 --> 00:10:07,740 So, obviously, not a very complex policy, but it 189 00:10:07,740 --> 00:10:11,590 doesn't matter how complex it is to see how to edit this. 190 00:10:11,590 --> 00:10:15,960 So what we do is we say edit route-policy, 191 00:10:15,960 --> 00:10:17,560 and we put in the name. 192 00:10:17,560 --> 00:10:19,510 In this case, it's all. 193 00:10:19,510 --> 00:10:23,130 And what you want to see here is that there are three choices 194 00:10:23,130 --> 00:10:25,350 that we can use to edit this. 195 00:10:25,350 --> 00:10:27,180 All three of these are, of course, 196 00:10:27,180 --> 00:10:30,840 rather well known Linux-based text editors. 197 00:10:30,840 --> 00:10:34,440 You can choose whichever one you're the most familiar with. 198 00:10:34,440 --> 00:10:37,890 Personally, I usually use Nano or Vim. 199 00:10:37,890 --> 00:10:40,410 So let's just take a look at Nano. 200 00:10:40,410 --> 00:10:44,970 And as we can see, it simply opens the file in Nano. 201 00:10:44,970 --> 00:10:47,530 And we could edit this however we want. 202 00:10:47,530 --> 00:10:51,930 So if I wanted to, I could change the pass to a drop, 203 00:10:51,930 --> 00:10:56,220 and then we could hit Control O to write this out. 204 00:10:56,220 --> 00:10:59,285 It's going to ask what do we want to name the file. 205 00:10:59,285 --> 00:11:01,410 Keep the default because this is what the system is 206 00:11:01,410 --> 00:11:03,540 using in the background. 207 00:11:03,540 --> 00:11:04,980 So hit Enter. 208 00:11:04,980 --> 00:11:07,167 We'll hit Control X to exit. 209 00:11:07,167 --> 00:11:09,250 It's going to ask if we want to commit, of course, 210 00:11:09,250 --> 00:11:10,860 we're going to say yes. 211 00:11:10,860 --> 00:11:13,260 Fortunately, I'm not using that policy for anything 212 00:11:13,260 --> 00:11:14,790 on this system right now. 213 00:11:14,790 --> 00:11:17,530 Let's do a show RPL again. 214 00:11:17,530 --> 00:11:20,440 And we can see that policy now says drop. 215 00:11:20,440 --> 00:11:21,850 So it's that easy. 216 00:11:21,850 --> 00:11:25,080 It's just like editing any other text file using 217 00:11:25,080 --> 00:11:27,090 one of these text editors. 218 00:11:27,090 --> 00:11:29,370 Now, the downside, of course, to this is 219 00:11:29,370 --> 00:11:31,260 don't have context sensitive help. 220 00:11:31,260 --> 00:11:35,970 You're on your own just writing the policy in the text editor. 221 00:11:35,970 --> 00:11:37,500 Now, two other useful commands you 222 00:11:37,500 --> 00:11:41,190 might want to be aware of in relation to RPL 223 00:11:41,190 --> 00:11:46,110 is if we do our show RPL again, and we say route-policy, 224 00:11:46,110 --> 00:11:50,970 ask for the name of our policy again, we can say detail. 225 00:11:50,970 --> 00:11:53,790 Now, in this case, it doesn't really change anything, 226 00:11:53,790 --> 00:11:56,550 but on a more complex policy and a policy that's 227 00:11:56,550 --> 00:12:00,570 actually in use, you would get more information out of this. 228 00:12:00,570 --> 00:12:05,050 And another good command is to say attachment points. 229 00:12:05,050 --> 00:12:09,040 This will tell you where the policy is actually being used. 230 00:12:09,040 --> 00:12:11,910 And as I mentioned before, this particular policy 231 00:12:11,910 --> 00:12:15,100 is not being used on this device at this time. 232 00:12:15,100 --> 00:12:19,170 So it's not attached to any attached point. 233 00:12:19,170 --> 00:12:22,050 We'll review these commands as we get more 234 00:12:22,050 --> 00:12:26,520 into other parts of the course, and we start using RPL more 235 00:12:26,520 --> 00:12:29,210 in other sections. 236 00:12:29,210 --> 00:12:31,990 So in this video, we took a look at some 237 00:12:31,990 --> 00:12:34,630 of the more advanced features of RPL, 238 00:12:34,630 --> 00:12:38,260 including our nesting, our parameterization, 239 00:12:38,260 --> 00:12:41,620 setting up sets, and editing a policy 240 00:12:41,620 --> 00:12:44,680 without having to rewrite the whole thing in configuration 241 00:12:44,680 --> 00:12:45,650 mode. 242 00:12:45,650 --> 00:12:47,650 I hope this has been informative for you, 243 00:12:47,650 --> 00:12:50,640 and I'd like to thank you for viewing. 244 00:12:50,640 --> 00:12:54,000