Home » Routing » BGP » BGP Attributes: Local Preference Attribute

BGP Attributes: Local Preference Attribute

The local preference attribute is a well-know discretionary attribute. This means local preference must be recognized by all BGP implementations, but will not exist in all BGP update messages; specifically it will not exist in E-BGP update messages.

BGP local preference attribute is one of the most used attributes in BGP real world to influence traffic. Local preference attribute is a four octet field of information that is used to inform internal peers about the autonomous system internal preference for an advertised route.

Local preference will exist in all internal BGP update messages and will never be included in external update messages as I mentioned before, except in the case of BGP confederations.

Local Preference attribute is used to influence traffic in the upload direction; each external route is assigned a preference value based on a configured policy that attaches this preference value to the LOCAL_PREF attribute in the update messages upon sending to internal peers. Local Preference is typically manipulated at the provider edge before sending the route to other internal peers.

When a BGP speaker receives the same route more than once it examines the local preference of the routes and the highest one wins and is considered the best route.

The default value for the LOCAL_PREF attribute is 100 on both Cisco and Juniper routers. This value is changed on IOS routers using a route-map and RPL on IOS-XR while on Juniper routers a policy is used to change the value.

The illustration below makes it more clear, lets check it:

BGP attribute - Local Preference

As you can notice in the illustration above , Prefix is advertised to AS XYZ from two different upstream providers R1 and R2. The Local Preference attribute value is set using a policy on AS:XYZ edge routers Rx and Ry. Rx sets the value to 200 and Ry sets the value to 150 and both advertise the route to Rz as an iBGP update.

Now, Rz has two routes to the same destination one from Rx and another from Ry but the route through Rx has a higher local preference of 200 and is selected as a best route and moved to the forwarding table.

The very good thing about Local Preference is that it comes first in the best route selection algorithm for BGP providing a clean and easy way to control upload traffic exiting your autonomous system to the internet.


  1. Martin

    what happens if no local preference is set?

  2. default is 0

  3. Voja

    Wrong…default is 100