BGP Local-Preference Attribute Cisco Router
BGP Local-Preference Attribute Cisco is another BGP attribute that’s important in the decision process for multiple redundant paths. In fact, if you’re concerned about the order of things, you should know that on Cisco routers, the “weight” attribute is checked first, so that if a given neighbor has a higher weight, the local preference isn’t even checked. However, it’s still quite important because it is an important attribute on all routers, and it affects the BGP routing process in much the same way.
Local Preference is one of the ways to alter the path taken by one AS to reach another AS. The difference between Local Preference and Weight is that Weight is just locally significant in the router while Local Preference is what I call “Local AS significant”. What I mean by that is that Local Preference is being propagated Intra AS but not outside the AS.
- Local preference is to influence your own AS how to get or exit to another AS.
- The higher the local preference, the more preferred.
In this lab, local preference will be configured and will be using route map for more flexibility. Check the diagram below for details.
R1, R2 and R3 belongs to AS 123. R4 is in AS4 and is advertising 18.104.22.168/32, 22.214.171.124/32 and 126.96.36.199/32
subnets.We need to set all routes learned from R3 to have local preference value of 300. After which, configure a
route-map that will assign a local preference of 500 in R2 for the network 188.8.131.52/32.
[adsense]Here are the initial BGP configurations on the routers.
R1# ! router bgp 123 no synchronization bgp log-neighbor-changes neighbor 184.108.40.206 remote-as 123 neighbor 220.127.116.11 remote-as 123 no auto-summary R2# ! router bgp 123 no synchronization bgp log-neighbor-changes neighbor 18.104.22.168 remote-as 123 neighbor 22.214.171.124 next-hop-self neighbor 126.96.36.199 remote-as 4 no auto-summary R3# ! router bgp 123 no synchronization bgp log-neighbor-changes neighbor 188.8.131.52 remote-as 123 neighbor 184.108.40.206 next-hop-self neighbor 220.127.116.11 remote-as 4 no auto-summary R4# ! router bgp 4 no synchronization bgp log-neighbor-changes network 18.104.22.168 mask 255.255.255.255 network 22.214.171.124 mask 255.255.255.255 network 126.96.36.199 mask 255.255.255.255 neighbor 188.8.131.52 remote-as 123 neighbor 184.108.40.206 remote-as 123 no auto-summary
Let’s see what is the best path taken by R1 to reach the networks advertised by R4.
It’s clear that it prefers to take R2 to reach the networks in R4. Let’s configure R3 so that all routes received by R3 will have a Local preference of 300
R3#config t R3(config)#router bgp 123 R3(config-router)#bgp default local-preference 300
Immediately, even without clearing the BGP process, R3 now became the more preferred path to reach R4. Remember that in Local Preference, the higher the value, the more preferred.
Let’s configure in R2 a route-map so the network 220.127.116.11/32 will have a local preference of 500. This will make R2 the best path to reach the mentioned network.
R2(config)#access-list 1 permit host 18.104.22.168 R2(config)#route-map LOCALPREF500 permit 10 R2(config-route-map)#match ip address 1 R2(config-route-map)#set local-preference 500 R2#(config)# router bgp 123 R2(config-router)#neighbor 22.214.171.124 route-map LOCALPREF500 in R2# clear ip bgp *
Firstly, why is that the route-map has an “in” direction. It’s because we are receiving the route from another router, R2 is not the one advertising. You can see now that path to 126.96.36.199/32 will have R2 as the next hop. If you noticed also, why is that for 188.8.131.52/32 and 184.108.40.206/32, there is no other path except through 220.127.116.11. Check the route-map above and you’ll find the answer. There is no succeeding line after line 10, which means, it will block out the subnets and not advertised it to R1.
Let’s configure the 20th sequence of the route-map.
R2(config)#route-map LOCALPREF500 permit 20
Let’s see now if there are changes.