350-501 SPCOR Cisco CCNP Service Provider – Weight & Local Preference part 4

  1. Local Preference – with Route-Maps

In this video, we’ll continue with our local preference lab, what we have left in our previous video. Let me just quickly revise what we did. Now in our previous video, we have seen that all the routers inside the Asix, by default, they are preferring this route, not this one. So probably this one, this route to reach 40 dot network, this is the preferred path. And the reason it is preferred path because it is having only one as hop, just 700 and I. So it’s receiving the route with 700 and i. But whereas it is having two as hops, 700, 400 and I. So this is the default best path or default preferred exit path in as 600 is this is the default exit path because of less as hops. Now, what we did, we went to router two and we changed the local preference of the router two to 400. And the default exit path which is router three is having the default local preference of 100.

Now, when we apply the local preference of 400 on router three, router two, router two is going to rise that information to all the routers inside the same as in our case, it is only router three and then router three. And once we once we apply that local preference, router two is into router three and all the routers inside the as by default they prefer via this path. This is the path which prefers so that’s what we did. If you verify the configurations here, like we went to router two and then we verified the configurations on the router two, we have applied this command BGPD for local preference value of 400. And once we did that automatically to reach any network, it’s by default preferring this route. That is why our router two will be the exit path.

Even if I verify the router three, router three also uses the default exit path will be wire two, two, one because of the local preference. But the one thing we in our previous slab we did is we did not match any networks. So which means when you say 400 on router two, it is automatically going to apply for all the routes, whatever received, whatever is coming from this router two. And then router two is going to advise all the networks for all the networks, it’s going to apply the local preference value of 400 and it’s going to advise to all the routers within the same as. Now you may come across a scenario where you want to apply local preference to only selected routes. Let’s say now in my example, now in this example, what we are going to do is we are going to remove that local preference whatever we have applied.

The first thing I’m going to say, router BGP 600. And if you remember what we applied, showrun section PGP. So I’m going to remove the command what I did in our previous lab and I’ll clear the PGP process if I verify I just want to ensure that all the routes should go via the default route which it is using. The default route is via router three. Similar way if I go and check on the router three I should not see this 400 after this you can see here when I go and check now there is no local preference value. Now router two is a realizing with a default local preference value and the default exit path to reach 40 dot network or any of the network is via three three two which is direct wire out of four. Even router two also uses this route to reach that 40 dot network or any network in a is 700.

Now in this lab what we are going to do is we are going to use local preference but we are going to apply only for specific routes. So which means I’m going to take some extra interfaces here you can see on the router for I’m going to use four loop bags. Now in that four loops I want to ensure that to reach some of the loop backs or I can say I got four different destinations and to reach some destinations like to reach the first two destinations I want my router to prefer this route the first two loop bags should go via this route. In my example I’ll be using 140 they should go via they should exit my router two and all the remaining routes all the remaining in the sense in my in my example all the remaining which means it includes the remaining two loop backs it also includes my 40 dot network.

It also includes whatever the networks belonging to as 700. So here we are just considering a S 700 as our destination network and as 600 as a source. So you can also take ten dot network or any other network so only the difference is the best path will change but the overall concept remains the same. So all the remaining should use the default path which is wire out or two. Now, if you want to make this possible, the first step we need to do is we need to match those two networks, whatever the two networks, we need to match fourteen zero, zero. And I’m going to say 14 10 with some ACL. Or you can use IP prefix list. And then I have to define that inside a route map. And inside that route map, I have to call that. I have to define that ACL. And then I’m going to say set local preference.

And the local preference value will be 400, 500, whatever the number you want to use. Now when I define this inside the route map now this local preference will be applied only for the networks whatever I have defined inside my ACL, okay? And then for all the remaining networks some name I’ll simply set the default values and then I’m going to apply on the router Two towards router one, okay? And on the indirection because I want to ensure that router Two should apply means the changes should apply to the router two. That’s the reason we apply indirection. So the same way what we did in our weight attribute. So let me just quickly do that before I do, let me just explain you the same thing here. Now, the first thing we need to do is we need to advertise the networks.

Anyway, router four is having the loop back but I did not advertise them in my BGP. So the first step will be we need to have some couple of networks for testing purpose. So for testing I’m going to use router for low back interfaces and I’m advertising them in network 140 with a 24 subnet mass and then also advertising my 14, 10 and 2030. So if you want you can add some extra loop backs also. So once we advertise them, you can see inside my PGP, I can see those 14 dot networks will be advertised. And the next stop is zero. Zero. Zero means tightly connected. And if I go to my Router three in my BGP table, I should see them coming into my BGP table on Router Three. You can see now it’s coming. And by default, it’s preferring via the route via three, three, two.

That is router four because of less as hops. Even if you only can try trace 14 one or if you try to trace through any other networks, any routes on the router four, by default it exists via router three. That is, the router three is your default. Exit path and same way if I check on the router two also it’s the same case by default prefers router three that is exist by router three because of less as hops. Now I want to ensure that router Two should use means the as 600 should exit via router two only for these two networks, okay? And for all the remaining networks it should use the default route. So which means the first thing you have to decide which router you want to exit. That’s the first step. Now I want to prefer exit out of two should be my exit router.

So we are going to apply the local preference on the router two so let us apply the local preference value on the router two. But before that I need to match those networks access listing, match those two networks. So in my example, I’m going to use the first two low backs, which are 140 zero. I’m going to match these two low backs, and then I’m going to create a route map, some name, CCI permit ten, match IP address. I’m going to match IP address 14, which means it is going to match these two networks. And then I’m going to say, set local preference, any number you can apply. So I’m going to apply just 400 or any number you can use then all the remaining. So again you have to define a route map with a blank roadmap statement which is going to ensure that all the remaining values should get the default parameters.

Finally the next thing we need to apply it towards the neighbor where you want to apply. So now when you apply on the router two pointing towards this neighbor, that’s what we are doing because we are going to receive the routes from this neighbor. So I’m going to apply it towards the neighbor router one which is neighbor one, one which is my router one and then I’m going to say route map and the name of the route map will be CCI. Now we need to define the direction now in our example we want to ensure that router two should apply the local preference value which means our router two itself I want my router two to change the local preference value when it resisted router three so it’s going to impact the local router.

So whenever you want to apply any values which would impact the local router then we always use indirection so in and then finally applying clear IPGP verification. Now once by the time the routes get converged we’ll quickly try to understand what happens after the conversion. So once the routes get converged, the first thing what we’ll see is we’ll see router two and router three. To reach this 40 dot network, they go via via this path. Because we have applied only those two networks. The local preference value and for all the remaining loadbacks. Which means the remaining means it will be fourteen, zero, two and three and also 40 network. They go via this route, which means local preference value will not be applied to the remaining networks and they use the default route. So that is something what we expect.

Shui Pbgp you can use or you can simply say Shui Pbgp 140 low back I can see the local preference value of 400 is applied for this network, or you can verify the routing table as well. And if I verify for 140 network you can see the local preference value is applied for the second network also because that we define in my ACL. If I verify for three dot network you can see the local preference value. Is not applied and it is just using the default local preference value. Because when we created a route map, we matched ACL 14. And that ACL 14 is going to represent only those two networks, which means the local preference value will be applied only for those two networks. And if I verify the routing table, you can see by default, to reach 14 0010, they go via router one. But if you see the remaining loop bags, they still go via the default route, which is via exit.

Via router three and similar way if I check any other router inside the same as because when you apply the local preference value it is going to apply for it is going to advise for all the networks within the same autonomous systems. Like you can see router three is receiving the route from 2221, which is router Two, with a local preference value of 400. Whatever we applied, it’s going to get advertised to all the routers inside the Is. But from 3332 we are receiving the route from with a local preference value of 400. Out of these two, it is going to decide which is the best route. It says this is one is the best route because of higher local preference. The same thing applies for 140 one network. Also local preference of 400 from Router two, default local preference from router four and this will be considered as a pest route.

And if I check for the third low back or the remaining loop backs, you can see it’s getting the route from one side with a local preference of 100. And if I verify the routing table, you can see these two loadbacks are going via two to two one that is via router two. But whereas the remaining low backs or the 40 dot network is going via the default exit path, this way we can use local preference for more specific routes. Especially it is more commonly useful when you have multiple destinations and you want to ensure that to some specific destinations you want to use the primary route and for the remaining destination you want to use the default route. So in this way we can ensure that we are going to use both the routes to exit the autonomous system number.

  1. BGP Path Selection Process

PGP path selection process. Now in this video we’ll see what is the path selection process in PGP like. If you remember, we have seen some of the IGP protocols like OSP of EHRP and R-I-P. Every routing protocol is having its own best path manipulation. Light OSPF. Always consider the bandwidth whichever the root is having the least and with that route will be considered as the best route. Whereas EHRP is going to see bandwidth delay, load, MD reliability, whereas Rap will count the number of Hopkins and whichever the route is having the least Hopkins, that route is considered as the best route. And in case if they come across a scenario where both the routes are having the equal metric or equal cost, then it is automatically going to do load balancing. But when we compare the BGP, BGP is totally different when we compare with your IGP protocols.

Now, BGP is the protocol, it’s a forwarding BGP forwarding table. Usually when it is having multiple paths, it is going to choose anyone, anyone as the best path. Now, the best path is based on the policy or step by step procedure of shaking it’s not at all based on the bandwidth like we have in IGP. So this is a default passelation. So let’s try to understand what is the default passelation process. But before that you need to have a very good understanding of different attributes. Like we discussed that PGP is going to consider the attributes which is going to define the policy, which route should be preferred over the other route. In that we have seen a lot of attributes like weight attribute and local preference attribute. So these two attributes will define how to exit this.

So whichever the root is having the higher weight or higher local preference, that root will be considered as a best route. Now let’s try to understand what is the default path selection process in BGP when you have multiple attributes or multiple values are applied to once any specific paths. Now, when it comes to sort selection process in BGP, ensuring that all the routes are synchronized with no loops and all the routes are having with a valid next stop. Valid next stop means the next stop is reachable. Now we are going to consider by default it’s going to prefer the highest weight. Now it will consider the weight local preference as path. Anyway, we have many options we have which will decide the best route. But when it comes to preference, the weight will be highest preferred than any other route.

So which means if we say let’s take an example, I have a router and it is having two exit paths outside our A’s and one route is having the weight of 1000 and the other route is having the weight of just 200. Now, when it comes to pass ration process, our router will always prefer this route. This route is much preferred than this route because of higher weight. So even if you apply the local preference, let’s say if I apply the local preference of 500 here and the local preference of this route is just 100. Now, even though we have two things applied, like we have a local preference applied as well as we have a weight and according to weight this is the best route, the first one, and according to local preference this is the best route. But the router or the BGP has to listen to anyone.

So by default it is going to listen to weight. So weight is local to the router and it is the highest preferred than any other attribute. So that’s what when you come across this type of scenarios where you have two or more than two attributes applied, it’s going to choose any one of the attribute based on this path selection process. So weight is highest preferred than any other attribute. But let’s say in case if you don’t have a weight, let’s say I don’t have a weight and I got two multiple paths again. Now, this time this root is having a local preference value of 200 and I have a local preference value of 100 on this side and on both the side there is no weight applied. So when there is no weight applied means the default weight for any network which is not directly connected will be the default weight will be zero.

So in case if there is a tie in the weight or if there is no weight is applied, so when there is no weight is applied, means it will be by default zero. In that case, then only it is going to prefer the local preference. Now, as per this example, this will be considered as your best route and the reason is because the weight is same and it is going to decide the best route based on the local preference values. Now, let’s take an example in case if you don’t have a weight or local preference, in case if weight is same, which means zero by default for any non directly connected network, the default local preference value is 100 and if it is same on both the sides. Now, in both the cases the weight and local preference are same, on both the sides it is same. Let’s say this is zero and the local preference default is 100 and both are same.

Now, in that case it is going to see preferred the route originated by the local router, which means it will see if this route is originated by the local router. Let’s say there is a network called one dot network. So this is my one dot network which is connecting between our router one and router two. And to reach this one dot network, the other end, this is the default best route. Now, even you can go from alternate route which is not directly connected. Now by default it will prefer the directly connected route. So now you can see here even weight and local preference are more preferred than directly connected. In case if I apply the weight of 40,000 here and the weight of directly connected network will be 32768 and the router will decide the best route based on the weight rather than going directly connected.

So you can see that’s the reason that’s the impact of weight and the local preference, so they are more preferred than directly connected network. Now, if if there are two multiple routes, one is directly connected and the other one is not coming directly and if both the side’s weight is same, let’s say the weight is same and also the local preference is also same, then it is going to prefer the directly guaranteed route. So that’s the next thing it is going to consider when it comes to the best path selection process. Now, in case if there is no weight applied or if the weight is same and the local preference is also same and both the sites the route is issued but they are not directly connected, in that case it is going to prefer the next condition is autonomous system path.

Now, again I’m going to take the similar example. I got two roots in both the sites I got the weight is same, local preference is also same on both the sides and also both the sides. There is one network called ten dot network which is learning from different autonomous system numbers and this network is also coming from this side. Now, first it will decide based on the weight. Now, in our example there is no weight applied or if it is applied it can be same. Local preference is also same and this tender network is not directly connected network of router one, it’s somewhere advertised by other router into BGP. In that case it is going to decide the best route based on the autonomous system path information.

Which means let’s say the route is advertised from this side with ashop of 500, 600 and reaching to MYS and then it is advertised from the other end with some other different days, let’s say 700, 800, 900 and I. Now the router one is receiving this ten dot network from both the ends and there is no weight applied, there is no local preference and this network is not directly connected network. It is going to decide the factor based on autonomous system path attribute. It’s going to see which route is having the least number of autonomous systems. Now, in this case it is two and in this case it is three. Now, the default best path will be this one because of least autonomous system paths. So that’s the reason when we say BGP is going to calculate the best route based on the autonomous system path information.

Why? Because the default weight will be the same or whatever, zero for any down directly connected network and the default local preference will be always 100 and maybe the route is not directly connected. So definitely it will go in most cases the best truth will be calculated based on as path information. Now you may come across a scenario where you may have the same autonomous system paths. Let’s take an example. I’m going to consider the same network. If I’m receiving the same route from both ends with the same as Hop. Let’s say this side I’m receiving with 700 800 and I from this side and I’m also receiving the same network from this side with two as Hops. Now in this case the weight is same, local preference is same and it’s not directly kind of network.

So probably the next path will see as path is also same. Then it is going to decide the best route based on the origin code based on the origin means. Now in some cases you may see the routes. Now this tender network is going to arise from this side and it is doing redistribution let’s say. So from this side I’m receiving the route to redistribution and then from this side we are going to receive the route from the other end as Ie. So if in case if weight is same, local preference and as path is same, then it is going to see the origin code. Now by default it is going to prefer I which is always the best. When you say I means it is the network which is advised in BGP, more preferred than E, more preferred than Kushama.

So when the route is coming with BGP network command and also coming through redistribution from the other end, it always prefer the route which is learned with this origin code I. Okay? So that is the next step which it will see when it decides the pistol. After that, in case if the original code is also same. So weight is same, logo preference is same and the route is not IoT connected and both the routes having the same autonomous system paths. And let’s say if both the roots are learned through IGP or learned advertised in IGP. So in that case both the sides, if you say both are coming as II and also same as Hops, then it is going to see something called mid value MIT. Now mid is one of the attribute which is used. In other words we call it as metric. Now it is a little bit opposite to your local preference or weight.

Local preference and weight are going to decide how to exit the Is, whereas metric value is used to define how to enter the Is. So it’s going to impact on the remote as in general. So the default mid value will be always zero and we are just assuming that we have the default mid value of zero. So which is multi exit discriminator exchange between the tournament system numbers. Now in case if the mid value is also same, the metric value is also same which is default zero, then it is going to see the nearest neighbor type. Now assuming that all the above six steps are same, then it will decide the best route based on administrative distance or the neighbor type we can send. Now by default it is going to prefer the route coming from EBGP when compared over IBGP.

So which means in our scenario, let’s take an example. I’m getting a route. So my router is receiving the route from this side. This router which is part of the same as and also I’m receiving the route from another router which is in different as. This is my as 500 and this is my as 600. So now the same network whatever the network that is ten dot network is getting a reduced from this side as well as getting a reduced from this side. Now my router is going to receive the router one receiving from the same net tender network from both ends. Now assuming that all the six MP steps are same like the weight look preference as path origin code memory value, now it is going to consider the best route. The best route will be calculated based on this is your Ebgpp and this is your Ibgpp.

So now it is going to install the route coming from EPGP because of administrator distance 20 and from administrator distance 200. So EBGP will be more preferred route. Now the router one is going to use this route to reach tender network because of EBGP. So it’s going to prefer the route coming from EBGP rather than preferring the route coming from IBGP. So that is the next step it is going to see when it decides the best route. In case if both the routes are coming from the same type of neighbor, let’s say both the routes are coming from either EBGP or either IBGP. So if both the routes are coming from EBGP, let’s say both are in different areas, then again there is a tie in this condition also. Now, in that in a scenario, it is going to see the nearest IGP metric, the smaller values preferred to the next stop.

And if both are both are having the same metric in case, which is very rare generally, then it’s going to prefer the oldest route for IBGP EBGP paths, whichever is the oldest route in the BGP paths. And if both are equally old, then it is going to prefer the lowest neighbor ID route ID. And if both routes are coming from the same neighbor, then it is going to prefer the lowest neighbor IPRs. So this is the default route selection process but BGP will not do load balancing by default. It is going to use any one specific route based on this default pass selection process. Now at least you should understand the six to seven steps. At least you have to memorize the default password process in order to figure out which path is used by the BGP. Now, to remember, we can use some simple shortcuts from Cisco Doc.

We can say here generally this is the shortcut which I generally use to memorize the password process. N says that it says valid next hop. Then we say WLA. W is weight local preference, the local route and autonomous system path the four values. And in case if all these four values are same, then it’s going to use something called omni origin met neighbor type EBGP preferred over IBGP and then the nearest IGP metric. Now, you can, you can use any other keywords as well to memorize these things, but it’s it’s really good to know and understand at the same time. You have to memorize these things. So whenever you see BGP is BGP table, when you say show IP BGP or show IP route BGP, you need to figure out which route is calculated as the best route. And based on these values, we can decide.

img