BGP Local Preference Attribute Explained

What is BGP Local Preference?

The BGP Local Preference attribute is used to manipulate the best outbound path and applied on inbound external routes. Unlike the Weight attribute, Local Preference is passed on to iBGP peers.

If multiple paths exist, Local Preference informs iBGP routers how to exit the AS ie which path to prefer for outgoing traffic. Local Preference is a 32-bit number and can range from 0 to 4294967295.

Advertisements

The default preference value is 100. The greater the Local preference e value, the more it becomes the preferred path

Related Article – eBGP vs iBGP

Local preferences can be applied in 2 ways –

1. Directly putting default local preference by iBGP router to its neighbours. Eg –

R3(config)# router bgp 1
R3(config-router)# bgp default local-preference 200

2. On per route basis by calling a Route-map and access/prefix-list through a neighbour. Eg –

R3(config)# ip prefix-list net4 4.4.4.0/24
R3(config)# route-map PREF permit 10
R3(config-route-map)# match ip address prefix-list net4
R3(config-route-map)# set local-preference 300
R3(config)# router bgp 1
R3(config)# neighbour 192.168.35.5 route-map PREF in

Below scenario will help in clarifying how local preference can be configured –

BGP Local Preference Attribute

BGP Local Preference Attribute

Related- BGP Origin Attribute

As in the above diagram, we are required to have R1 prefer R3 instead of R2 as the best path for reachability to network 4.4.4.0/24 (Loopback of R4).

Related – BGP States

Under the normal case, R1 will receive route for R4 loopback from both iBGP neighbours R2 and R3 .R2 will be the preferred path based on BGP path preference criteria of R2 having lower Router ID ie 192.168.12.2 and R3 with Router ID 192.168.13.3. Below is the snapshot.

snapshot in bgp local preference

Now, we configure the R3 to advertise itself as a preferred path by manipulating the “Local Preference” value as below –t

R3(config)# ip prefix-list net4 4.4.4.0/24
R3(config)# route-map PREF permit 10
R3(config-route-map)# match ip address prefix-list net4
R3(config-route-map)# set local-preference 300
R3(config)# router BGP 1
R3(config)# neighbour 192.168.35.5 route-map PREF in

Once the above configuration is performed on R3 and the same information is learned by its iBGP neighbour i.e. R1, the best path for R1 changes from R2 to R3 since R3 has Higher (more preferred) Local preference than R2.

bgp-local-preference-attribute

 

Related – BGP Interview Questions

Related- BGP Allowas in

Share this:
Advertisements

Tags:

Related Posts

About The Author

No Responses

Add Comment

Social Media Auto Publish Powered By : XYZScripts.com