What is BGP Local Preference Attribute?
BGP Local Preference Attribute is an optional non-transitive BGP attribute that is used to influence the outbound traffic from a particular router. This attribute is local to each autonomous system, which means it has no impact beyond the AS boundary.
The BGP Local Preference Attribute can be used by network administrators to control the preference of which route will be taken when multiple paths are available for the same destination. The higher the value of the local preference attribute, the more preferred a particular route is by BGP.
This allows network administrators to control which path traffic takes out of an autonomous system. It also serves as a way to prevent congestion on certain links or prioritize certain routes.
BGP Local Preference Example:
- Let’s say two autonomous systems AS1 and AS2 are connected via a router. A network administrator in AS1 utilizes the BGP Local Preference Attribute to set a higher weight for one of the paths between these two autonomous systems, thus giving more preference to it and allowing traffic from AS1 to take that path when reaching the destination in AS2. In this way, the network administrator can control which path traffic takes out of the autonomous system.
BGP Local Preference Higher or Lower?
The BGP Local Preference Attribute is not a standard setting – it can be either higher or lower, depending on the requirements of the network administrator. Generally speaking, traffic will prefer the route with the higher local preference value. However, this is not always true as there are other factors that can influence routing decisions such as administrative distance, MED, and AS-Path.
How to Set Local Preference in BGP?
To set the local preference attribute in BGP, you must use the set local-preference command. The syntax of this command is as follows:
- set local-preference <value>
where “value” is the desired value for the local preference attribute. This value can be any number from 0 to 4294967295.
Using this command can help network administrators control the path that traffic takes out of an autonomous system.
Let’s say a network administrator wants to set the local preference value of 200 for all routes going through router R1. The command would look like this:
- R1(config)#set local-preference 200
This will set the local preference of all routes going through R1 to 200. This will allow the network administrator to prioritize certain routes and control the path that traffic takes out of the autonomous system.
BGP Med vs Local Preference
The BGP Local Preference Attribute is similar to the MED (Multi-Exit Discriminator) attribute. Both of these attributes are utilized by network administrators to determine which routes are preferred over others.
- The main difference between them is that the local preference value is used within an autonomous system, while the MED value is used when comparing different autonomous systems.
- The MED is sent to neighboring autonomous systems, while the local preference value is not.
- Therefore, if a network administrator wants to control the paths that traffic takes out of an autonomous system, they should use the BGP Local Preference Attribute.
- The MED should be used when comparing different routes from one autonomous system to another.
Frequently Asked Questions
Is the BGP Local Preference Attribute Mandatory?
No, the Local Preference Attribute is not mandatory for BGP to function. It is an optional attribute that network administrators can use to control which routes are preferred when multiple paths are available for a given destination.
Can I set the local preference of a route at runtime?
Yes, you can set the local preference of a route at runtime using the ‘set local-preference command. This will allow you to control which routes are preferred when multiple paths are available for a given destination.
What is the default Local Preference Attribute value?
The default Local Preference Attribute value is 100. This is the value that will be used if a route does not have an explicit Local Preference Attribute set.
How do I find out which path is preferred for a given destination?
You can use the ‘show IP BGP’ command to view the paths and their associated attributes for a given destination. This will allow you to determine which path is preferred for a given destination.
What is the maximum value for the Local Preference Attribute?
The maximum value for the Local Preference Attribute is 4294967295. This is the highest value that can be set for this attribute.
What route will the traffic take out of an autonomous system if two routes have the same local preference?
If two routes have the same local preference, the router will select the route with the lowest administrative distance. This is because the administrative distance value is a tiebreaker when two routes have the same local preference.