What is BGP Local Preference Attribute?
Local Preference attribute is used to choose external BGP paths. Different edge routers has different Local Preferences to an external destination. These values are sent between IBGP (Interior BGP) neighbours and according to these values, the AS (Autonomous System) exit point is determined. Local Preference is applied to the inbound interface and shows the best outbound interface towards another AS. In other words, here, it shows the exit point of your AS towards another AS.
The default value of Local Preference is 100. And always the highest one is choosen as a Best BGP path.
Think about the previous Weight Attribute. Weight attribute was configured as local to that router. But Local Preference attribute is not like this. Different routers has different Local Preference values for that destination. And these Local Preference values are shared withing the AS (Autonomous System).
Local Preference attribute is a Well-known and Discretionary BGP Path Attribute. As we mentined before, this means, it is supported by every BGP implementation (well-known) and every BGP router recognize it, but optionally present in the BGP Update packet (discretionary).
How to Assign BGP Local Preference to a Router?
BGP Local Preference value can be assigned to a router in two ways:
• By BGP default local-preference command
• By Route Maps
Let’s give an example for each of these BGP Local Preference assign ways. As a reference topology, we will use the below basic topology:
You can also test yourself with BGP Tests and Questions.