1 00:00:00,000 --> 00:00:07,150 2 00:00:07,150 --> 00:00:10,060 So in this video, let's start off 3 00:00:10,060 --> 00:00:14,810 by looking at the BGP path selection criteria as a whole. 4 00:00:14,810 --> 00:00:17,330 So we're going to go through all of the different steps. 5 00:00:17,330 --> 00:00:19,790 Now some of the steps are, of course, 6 00:00:19,790 --> 00:00:22,760 going to be broken down in future videos, 7 00:00:22,760 --> 00:00:26,320 the ones that require a little bit more discussion, and/or you 8 00:00:26,320 --> 00:00:28,840 could say the ones that we use more commonly 9 00:00:28,840 --> 00:00:30,940 for path selection. 10 00:00:30,940 --> 00:00:33,940 Some of the other ones, we will cover in full 11 00:00:33,940 --> 00:00:35,780 here in this video. 12 00:00:35,780 --> 00:00:37,390 But there are some of the rules that 13 00:00:37,390 --> 00:00:40,030 sound relatively straightforward that 14 00:00:40,030 --> 00:00:42,200 do have some caveats with them. 15 00:00:42,200 --> 00:00:45,160 So we're going to make sure we cover those either here 16 00:00:45,160 --> 00:00:48,190 or in the future videos, when we cover 17 00:00:48,190 --> 00:00:50,330 those topics individually. 18 00:00:50,330 --> 00:00:53,380 And we will make sure you understand which ones are which 19 00:00:53,380 --> 00:00:54,850 as we go through. 20 00:00:54,850 --> 00:00:58,360 And I'll mention whether this is going to be in a future video 21 00:00:58,360 --> 00:01:01,550 or if this is the most that we're going to be covering it. 22 00:01:01,550 --> 00:01:04,840 So let's jump in and look at the path selection criteria, 23 00:01:04,840 --> 00:01:07,750 looking at, well, some of the details, 24 00:01:07,750 --> 00:01:09,970 and saving some for future videos. 25 00:01:09,970 --> 00:01:12,950 26 00:01:12,950 --> 00:01:14,960 Our first step is that we're going 27 00:01:14,960 --> 00:01:19,580 to prefer the path with the highest weight. 28 00:01:19,580 --> 00:01:23,990 Now weight is actually a Cisco proprietary attribute. 29 00:01:23,990 --> 00:01:29,060 And as such, it does not get sent in BGP updates. 30 00:01:29,060 --> 00:01:33,470 Note, as we go down through the path selection criteria, some 31 00:01:33,470 --> 00:01:38,580 of these rules, such as rule one here, will be listed in blue. 32 00:01:38,580 --> 00:01:41,360 Some of them will be in yellow. 33 00:01:41,360 --> 00:01:45,470 The blue indicates that there's a more detailed video 34 00:01:45,470 --> 00:01:49,580 on how this works coming up later in this skill. 35 00:01:49,580 --> 00:01:52,190 If the rule is yellow, it means we're 36 00:01:52,190 --> 00:01:54,140 going to have the full discussion on it 37 00:01:54,140 --> 00:01:58,460 here in this video, because it's a fairly simple rule, 38 00:01:58,460 --> 00:02:00,740 and maybe it just has a few little caveats. 39 00:02:00,740 --> 00:02:03,050 So keep that in mind as we go down here. 40 00:02:03,050 --> 00:02:06,080 We're not going to be talking a lot about weight right now. 41 00:02:06,080 --> 00:02:10,770 Because again, there's a separate video coming up next. 42 00:02:10,770 --> 00:02:13,920 Sort of along the same lines is rule number two. 43 00:02:13,920 --> 00:02:18,150 This is the highest local preference. 44 00:02:18,150 --> 00:02:20,550 This one is not Cisco proprietary. 45 00:02:20,550 --> 00:02:24,000 It is part of the BGP standard, and therefore 46 00:02:24,000 --> 00:02:26,850 is carried in BGP attributes. 47 00:02:26,850 --> 00:02:29,790 Once again, the highest wins. 48 00:02:29,790 --> 00:02:34,350 Number three is our first rule, that's rather straightforward. 49 00:02:34,350 --> 00:02:37,230 And it simply says that we are going 50 00:02:37,230 --> 00:02:42,150 to prefer the path that was locally originated 51 00:02:42,150 --> 00:02:47,940 via either the network or the aggregate BGP subcommands, 52 00:02:47,940 --> 00:02:53,460 or through redistribution from an IGP. 53 00:02:53,460 --> 00:02:55,690 Now this is fairly straightforward. 54 00:02:55,690 --> 00:02:59,200 It's just saying that locally originated is preferred. 55 00:02:59,200 --> 00:03:03,270 However, note the caveat, adding a little more detail here, 56 00:03:03,270 --> 00:03:07,650 that local paths coming from either network 57 00:03:07,650 --> 00:03:12,930 or redistribution are preferred over something 58 00:03:12,930 --> 00:03:16,030 coming from the aggregate address command. 59 00:03:16,030 --> 00:03:19,080 So even within the locally originated, 60 00:03:19,080 --> 00:03:22,170 there's still a hierarchy where, again, 61 00:03:22,170 --> 00:03:27,210 network or redistribution beats out an aggregate address. 62 00:03:27,210 --> 00:03:30,540 Our next rule is simply to prefer the path 63 00:03:30,540 --> 00:03:34,020 with the shortest AS path. 64 00:03:34,020 --> 00:03:36,630 When we say shortest, we're talking 65 00:03:36,630 --> 00:03:42,730 about the number of AS's, not the actual length. 66 00:03:42,730 --> 00:03:55,680 So for example, if I had a path 65001 versus the path 123, 67 00:03:55,680 --> 00:03:59,820 the winner here is going to be the 65001. 68 00:03:59,820 --> 00:04:02,250 Because even though the bottom path might only be three 69 00:04:02,250 --> 00:04:06,060 numbers, it's three separate AS's. 70 00:04:06,060 --> 00:04:10,110 So again, it's the number of AS's in the path. 71 00:04:10,110 --> 00:04:13,350 Next is another fairly straightforward rule. 72 00:04:13,350 --> 00:04:18,550 We prefer the path with the lowest origin type. 73 00:04:18,550 --> 00:04:24,060 So the lowest here is an I, which means IGP. 74 00:04:24,060 --> 00:04:27,600 In the case of a Cisco device, this generally 75 00:04:27,600 --> 00:04:32,040 means that the route was brought in with the network statement. 76 00:04:32,040 --> 00:04:35,250 Next would be E, meaning EGP. 77 00:04:35,250 --> 00:04:38,010 This is generally not going to be set anymore 78 00:04:38,010 --> 00:04:41,850 unless an administrator actually set the origin code 79 00:04:41,850 --> 00:04:48,210 purposefully to E. And then finally is the question mark. 80 00:04:48,210 --> 00:04:51,420 This simply means unknown origin. 81 00:04:51,420 --> 00:04:55,650 On Cisco devices, this generally means 82 00:04:55,650 --> 00:04:59,970 that this path was originated through redistribution. 83 00:04:59,970 --> 00:05:01,920 So all we really have to remember 84 00:05:01,920 --> 00:05:04,470 is that I is going to beat E, and E 85 00:05:04,470 --> 00:05:07,480 is going to be question mark. 86 00:05:07,480 --> 00:05:09,940 Now again another quick note here-- 87 00:05:09,940 --> 00:05:13,930 origin code is not very commonly used 88 00:05:13,930 --> 00:05:17,110 to manipulate path selection, which 89 00:05:17,110 --> 00:05:20,570 is why we're not discussing it in great detail here. 90 00:05:20,570 --> 00:05:25,480 However, this is still a part of the path selection criteria, 91 00:05:25,480 --> 00:05:29,920 and we can set this through route maps and route policy 92 00:05:29,920 --> 00:05:30,700 language. 93 00:05:30,700 --> 00:05:33,910 So keep in mind, although not common, 94 00:05:33,910 --> 00:05:38,920 we can certainly use the origin code to manipulate BGP path 95 00:05:38,920 --> 00:05:41,650 selection if we wanted to. 96 00:05:41,650 --> 00:05:47,620 Next up is to prefer the path with the lowest multi exit 97 00:05:47,620 --> 00:05:50,770 discriminator, or MED. 98 00:05:50,770 --> 00:05:53,890 Cisco generally refers to this as the metric 99 00:05:53,890 --> 00:05:55,330 when you're configuring it. 100 00:05:55,330 --> 00:05:58,540 And in show and debug commands, there 101 00:05:58,540 --> 00:06:01,390 are a few exceptions where they refer to it as the MED, 102 00:06:01,390 --> 00:06:06,190 such as when you're setting it in RPL on iOS XR. 103 00:06:06,190 --> 00:06:09,130 But generally, speaking when you see metric, 104 00:06:09,130 --> 00:06:10,900 they're referring to the MED. 105 00:06:10,900 --> 00:06:13,120 And again, this is something that we have 106 00:06:13,120 --> 00:06:14,810 another video on coming up. 107 00:06:14,810 --> 00:06:18,460 So we're not going to spend a lot of detail on it right now. 108 00:06:18,460 --> 00:06:24,700 Next up is fairly simply to prefer external paths, or EBGP 109 00:06:24,700 --> 00:06:29,810 paths, over internal paths, or IBGP paths. 110 00:06:29,810 --> 00:06:33,170 Now once again, a few little caveats. 111 00:06:33,170 --> 00:06:36,340 First, if best path is selected, we're 112 00:06:36,340 --> 00:06:38,650 going to continue on to step nine, 113 00:06:38,650 --> 00:06:40,750 or multipathing, which we're going to be 114 00:06:40,750 --> 00:06:43,880 talking about in just a moment. 115 00:06:43,880 --> 00:06:50,200 Also note that if these paths contain confed attributes, 116 00:06:50,200 --> 00:06:54,040 they are considered local to the confederation. 117 00:06:54,040 --> 00:06:58,000 And for the sake of this path selection criteria, 118 00:06:58,000 --> 00:07:01,820 they will be treated as internal paths. 119 00:07:01,820 --> 00:07:04,660 There's no distinction between confederation 120 00:07:04,660 --> 00:07:07,810 external and confederation internal. 121 00:07:07,810 --> 00:07:14,110 Next is to prefer the path with the lowest IGP metric 122 00:07:14,110 --> 00:07:18,100 to the next hop, which is essentially just saying 123 00:07:18,100 --> 00:07:23,830 if this traffic is leaving the network anyway, 124 00:07:23,830 --> 00:07:28,630 then let's get it to the next hop through the closest IGP 125 00:07:28,630 --> 00:07:29,920 exit. 126 00:07:29,920 --> 00:07:33,580 And here we will continue, even if best path is already 127 00:07:33,580 --> 00:07:34,960 selected. 128 00:07:34,960 --> 00:07:39,100 Then we have step nine, which is our multiple paths, 129 00:07:39,100 --> 00:07:42,240 or our multi path rule. 130 00:07:42,240 --> 00:07:48,000 Now keep in mind, BGP will select one best path. 131 00:07:48,000 --> 00:07:50,550 That's what it's going to advertise to its neighbors 132 00:07:50,550 --> 00:07:51,590 and things like that. 133 00:07:51,590 --> 00:07:54,390 That doesn't mean that it can only put 134 00:07:54,390 --> 00:07:57,000 one route in the routing table. 135 00:07:57,000 --> 00:08:00,300 We can enable BGP for multipathing, 136 00:08:00,300 --> 00:08:03,390 and that's what rule 9 here is all about. 137 00:08:03,390 --> 00:08:06,330 The default on most Cisco platforms 138 00:08:06,330 --> 00:08:10,330 is to install one route from BGP into the routing table. 139 00:08:10,330 --> 00:08:13,365 But if you change the max paths to something like four, six, 140 00:08:13,365 --> 00:08:16,350 eight, something like that, then it's 141 00:08:16,350 --> 00:08:20,310 going to hit rule nine here and choose, essentially, 142 00:08:20,310 --> 00:08:24,990 which routes are a tie down to this point, 143 00:08:24,990 --> 00:08:28,800 and put all of those up to the max value 144 00:08:28,800 --> 00:08:30,970 into the routing table. 145 00:08:30,970 --> 00:08:34,440 And this is precisely why rules seven and eight 146 00:08:34,440 --> 00:08:38,700 said to continue, even if best path was selected. 147 00:08:38,700 --> 00:08:41,429 Because we had to still see if they were ties 148 00:08:41,429 --> 00:08:44,440 that could be put into the routing table. 149 00:08:44,440 --> 00:08:49,110 Now at this point, we're going to continue only if best 150 00:08:49,110 --> 00:08:52,360 path is not yet selected. 151 00:08:52,360 --> 00:08:56,640 So if it gets down to step nine here and we still have a tie, 152 00:08:56,640 --> 00:08:58,740 then we are going to still keep going. 153 00:08:58,740 --> 00:09:00,720 Because again, even though we might 154 00:09:00,720 --> 00:09:03,930 be putting all of those prefixes into the routing table, 155 00:09:03,930 --> 00:09:07,110 they can't be chosen as the best path. 156 00:09:07,110 --> 00:09:11,340 Because we only advertise one path to our neighbors. 157 00:09:11,340 --> 00:09:16,890 Next is rule 10, which simply says if both of the paths 158 00:09:16,890 --> 00:09:19,650 are external, then it's simply going 159 00:09:19,650 --> 00:09:23,460 to go with the one that was received first. 160 00:09:23,460 --> 00:09:26,220 The idea, of course, being that it's proven 161 00:09:26,220 --> 00:09:28,560 itself to be the most stable. 162 00:09:28,560 --> 00:09:32,700 The idea here is, it minimizes route flaps so that a newer 163 00:09:32,700 --> 00:09:36,330 path doesn't displace the older one all the time, even 164 00:09:36,330 --> 00:09:40,020 if the newer path would be the preferred route based 165 00:09:40,020 --> 00:09:45,090 on the next lesson criteria, such as 11, 12, and 13. 166 00:09:45,090 --> 00:09:47,830 Now this step won't always come into play. 167 00:09:47,830 --> 00:09:51,700 So we're going to skip this step in certain criteria. 168 00:09:51,700 --> 00:09:56,370 The first is if you have actually enabled BGP 169 00:09:56,370 --> 00:09:59,400 best path compare router ID. 170 00:09:59,400 --> 00:10:01,140 The reason for this is, of course, we 171 00:10:01,140 --> 00:10:03,420 haven't seen router ID yet. 172 00:10:03,420 --> 00:10:06,810 That's one of these steps, 11, 12 or 13. 173 00:10:06,810 --> 00:10:07,450 It's a mystery. 174 00:10:07,450 --> 00:10:08,280 We'll find out. 175 00:10:08,280 --> 00:10:11,200 But we haven't gotten to router ID yet. 176 00:10:11,200 --> 00:10:13,800 So if we're telling it it has to compare router ID, 177 00:10:13,800 --> 00:10:17,970 then clearly, we're not going to stop here at step 10. 178 00:10:17,970 --> 00:10:19,860 It will also skip it if the paths are 179 00:10:19,860 --> 00:10:22,770 from the same neighboring router ID, 180 00:10:22,770 --> 00:10:26,650 or if there's no current best path. 181 00:10:26,650 --> 00:10:28,770 It's not going to use this as the criteria 182 00:10:28,770 --> 00:10:30,630 to choose the best path. 183 00:10:30,630 --> 00:10:33,540 And it's also not going to look at this if the neighbor that 184 00:10:33,540 --> 00:10:36,370 was offering this goes down. 185 00:10:36,370 --> 00:10:39,090 It'll continue on with other steps. 186 00:10:39,090 --> 00:10:41,610 The next step is step 11. 187 00:10:41,610 --> 00:10:44,070 And as you can see, the mystery is solved now, 188 00:10:44,070 --> 00:10:48,660 because this is coming from the lowest router ID. 189 00:10:48,660 --> 00:10:50,710 The router ID, by default, by the way, 190 00:10:50,710 --> 00:10:54,600 is going to be the highest IP address on the router, 191 00:10:54,600 --> 00:10:58,500 with preference given to loopback interfaces. 192 00:10:58,500 --> 00:11:02,700 Or more preferably, you as the administrator 193 00:11:02,700 --> 00:11:05,490 can use the BGP router ID command 194 00:11:05,490 --> 00:11:09,020 and manually set the router ID. 195 00:11:09,020 --> 00:11:11,890 Now a quick note on the router ID here-- 196 00:11:11,890 --> 00:11:15,100 if you are doing BGP synchronization, 197 00:11:15,100 --> 00:11:17,830 which is not commonly done anymore, 198 00:11:17,830 --> 00:11:24,490 but if you are, and your underlying IGP is OSPF, 199 00:11:24,490 --> 00:11:30,790 there is an RFC that states that the BGP router ID and the OSPF 200 00:11:30,790 --> 00:11:35,660 router ID must match in order to do synchronization. 201 00:11:35,660 --> 00:11:38,530 So keep that in mind in your design 202 00:11:38,530 --> 00:11:43,030 if you are doing BGP and OSPF with synchronization, which, 203 00:11:43,030 --> 00:11:45,140 again, not commonly done. 204 00:11:45,140 --> 00:11:48,520 But just keep that in mind with your router ID design. 205 00:11:48,520 --> 00:11:50,590 The fact of the matter is, you probably 206 00:11:50,590 --> 00:11:52,610 want to make them the same anyway, 207 00:11:52,610 --> 00:11:55,360 just because why have more than one address 208 00:11:55,360 --> 00:11:59,000 to remember a router by in two different protocols? 209 00:11:59,000 --> 00:12:02,050 So unless you had some outstanding reason to do so, 210 00:12:02,050 --> 00:12:04,810 we would probably make these numbers the same anyway. 211 00:12:04,810 --> 00:12:08,380 But just keep it in mind, that in that synchronization 212 00:12:08,380 --> 00:12:12,380 scenario, they actually do have to match. 213 00:12:12,380 --> 00:12:17,090 And one caveat on this rule, that if there's a route 214 00:12:17,090 --> 00:12:23,430 reflector, the originator ID is used instead of the router ID. 215 00:12:23,430 --> 00:12:26,000 So keep that caveat in mind when we're 216 00:12:26,000 --> 00:12:28,530 dealing with route reflectors. 217 00:12:28,530 --> 00:12:31,790 So we just had a caveat related to route reflectors. 218 00:12:31,790 --> 00:12:35,870 Now we have a whole rule for route reflectors. 219 00:12:35,870 --> 00:12:38,480 You can see right here, our first note, 220 00:12:38,480 --> 00:12:43,520 that this is only present in BGP route reflector environments. 221 00:12:43,520 --> 00:12:45,180 Well, what are we talking about? 222 00:12:45,180 --> 00:12:47,070 Well, it's quite simple. 223 00:12:47,070 --> 00:12:51,250 If that originator ID is the same for multiple paths-- 224 00:12:51,250 --> 00:12:53,750 which, again, that's what this whole path selection criteria 225 00:12:53,750 --> 00:12:55,220 is for-- 226 00:12:55,220 --> 00:13:00,860 we're going to go with the minimum cluster list length. 227 00:13:00,860 --> 00:13:06,290 Just like the AS path length, it's the number of clusters 228 00:13:06,290 --> 00:13:09,870 that this particular path goes through. 229 00:13:09,870 --> 00:13:12,890 So we're going to prefer to go through the lower 230 00:13:12,890 --> 00:13:15,150 number of route reflectors. 231 00:13:15,150 --> 00:13:17,240 So because of this rule, we can, in fact, 232 00:13:17,240 --> 00:13:20,810 peer with route reflectors or clients in other clusters 233 00:13:20,810 --> 00:13:22,740 without creating an issue. 234 00:13:22,740 --> 00:13:26,270 However, be aware that in order for this to work, 235 00:13:26,270 --> 00:13:31,490 the receiving router has to be aware of those route reflector 236 00:13:31,490 --> 00:13:34,160 specific BGP attributes. 237 00:13:34,160 --> 00:13:37,640 I can't imagine that any devices today would not 238 00:13:37,640 --> 00:13:38,970 be aware of that. 239 00:13:38,970 --> 00:13:41,930 However, maybe there's something out there that's not. 240 00:13:41,930 --> 00:13:43,790 Just be aware that this rule would not 241 00:13:43,790 --> 00:13:45,890 take effect in that case. 242 00:13:45,890 --> 00:13:52,160 Finally, we prefer the path that comes from the lowest neighbor 243 00:13:52,160 --> 00:13:53,450 address. 244 00:13:53,450 --> 00:13:56,870 This is going to be using the IP address that's 245 00:13:56,870 --> 00:14:00,120 used for the BGP neighborship. 246 00:14:00,120 --> 00:14:03,140 So this might be the directly connected physical interface. 247 00:14:03,140 --> 00:14:05,270 It may be a loopback interface. 248 00:14:05,270 --> 00:14:09,200 It's whatever address is used in the neighborship. 249 00:14:09,200 --> 00:14:12,560 Again, it's going to correspond with the remote peer 250 00:14:12,560 --> 00:14:15,720 in that TCP connection. 251 00:14:15,720 --> 00:14:19,910 So as you can see, this is flat out down to a tiebreaker. 252 00:14:19,910 --> 00:14:22,880 There's no way we're going to come out of Rule 13 253 00:14:22,880 --> 00:14:25,430 with two best paths. 254 00:14:25,430 --> 00:14:28,990 There will only be one. 255 00:14:28,990 --> 00:14:33,340 So in this video, we went through the BGP best path 256 00:14:33,340 --> 00:14:35,300 selection criteria. 257 00:14:35,300 --> 00:14:40,100 So when BGP has multiple paths to get to a single destination, 258 00:14:40,100 --> 00:14:43,240 it will go down this list, one by one, 259 00:14:43,240 --> 00:14:48,680 all 13 steps, if needed, till it comes down to one best path. 260 00:14:48,680 --> 00:14:52,480 Now we also saw that at rule nine, if we're 261 00:14:52,480 --> 00:14:55,630 putting multiple routes into the routing table, 262 00:14:55,630 --> 00:14:58,390 it can, of course, support multipathing. 263 00:14:58,390 --> 00:15:00,730 But it will still continue until it 264 00:15:00,730 --> 00:15:03,550 has one best path, because that's what it 265 00:15:03,550 --> 00:15:05,980 has to send to its neighbors. 266 00:15:05,980 --> 00:15:08,530 So we'll go down the list until there's 267 00:15:08,530 --> 00:15:13,700 a single path, eliminating all the other paths as we go. 268 00:15:13,700 --> 00:15:15,790 I hope this has been informative for you, 269 00:15:15,790 --> 00:15:18,900 and I'd like to thank you for viewing. 270 00:15:18,900 --> 00:15:22,000