November 21, 2024

BGP Local-Preference Attribute Cisco Router

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. [boxads]

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.

BGP Local-Preference Attribute Cisco Router
BGP Local-Preference Attribute Cisco Router

R1, R2 and R3 belongs to AS 123. R4 is in AS4 and is advertising 4.4.4.4/32, 44.44.44.44/32 and 144.144.144.144/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 144.144.144.144/32.

[adsense]Here are the initial BGP configurations on the routers.

R1#
!
router bgp 123
no synchronization
bgp log-neighbor-changes
neighbor 12.12.12.2 remote-as 123
neighbor 13.13.13.3 remote-as 123
no auto-summary

R2#
!
router bgp 123
no synchronization
bgp log-neighbor-changes
neighbor 12.12.12.1 remote-as 123
neighbor 12.12.12.1 next-hop-self
neighbor 24.24.24.4 remote-as 4
no auto-summary

R3#
!
router bgp 123
no synchronization
bgp log-neighbor-changes
neighbor 13.13.13.1 remote-as 123
neighbor 13.13.13.1 next-hop-self
neighbor 34.34.34.4 remote-as 4
no auto-summary

R4#
!
router bgp 4
no synchronization
bgp log-neighbor-changes
network 4.4.4.4 mask 255.255.255.255
network 44.44.44.44 mask 255.255.255.255
network 144.144.144.144 mask 255.255.255.255
neighbor 24.24.24.2 remote-as 123
neighbor 34.34.34.3 remote-as 123
no auto-summary

Let’s see what is the best path taken by R1 to reach the networks advertised by R4.

R1 BGP table
R1 BGP table

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
BGP Table
BGP Table

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 144.144.144.144/32 will have a local preference of 500. This will make R2 the best path to reach the mentioned network. [bodyads]

R2(config)#access-list 1 permit host 144.144.144.144
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 24.24.24.4 route-map LOCALPREF500 in
R2# clear ip bgp *
BGP Table LocPrf
BGP Table LocPrf 500

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 144.144.144.144/32 will have R2 as the next hop. If you noticed also, why is that for 4.4.4.4/32 and 44.44.44.44/32, there is no other path except through 13.13.13.3. 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.

BGP Table LocPrf-3
BGP Table LocPrf

Shahed

Hi! I am Shahed Israr. I try to help GPON Technology users with their queries and provide them with relevant and accurate information to the best of my ability. My main goal is to assist and enhance GPON Technology user and help people find the answers they're looking for quickly and easily.

Follow Me:
TwitterFacebookLinkedInPinterestGoogle PlusDiggYouTubeRedditDelicious

Visited 139 times, 1 visit(s) today

Comments

comments

Shahed

Hi! I am Shahed Israr. I try to help GPON Technology users with their queries and provide them with relevant and accurate information to the best of my ability. My main goal is to assist and enhance GPON Technology user and help people find the answers they're looking for quickly and easily.

View all posts by Shahed →

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

error: Content is protected !!