The apply local-preference command sets the local preference (Local-Pref) for BGP routes.
The undo apply local-preference command cancels the configuration.
By default, the Local-Pref of BGP routes is 100.
| Parameter | Description | Value |
|---|---|---|
| preference | Specifies the Local-Pref of BGP routes. | The value is an integer ranging from 0 to 4294967295. |
Usage Scenario
The Local-Pref attribute is the proprietary attribute of BGP. Therefore, the apply local-preference command sets only the Local-Pref for BGP routes. The Local_Pref attribute is used to determine the optimal route when traffic leaves an AS. When a BGP router obtains multiple routes to the same destination address but with different next hops through IBGP peers, the route with the largest Local_Pref value is selected.
Prerequisites
The apply local-preference command can be used only after the route-policy command is used.
Configuration Impact
After a BGP route matches a route-policy, you can change the Local-Pref of the BGP route.
Precautions
The Local_Pref attribute applies to the routing within an AS rather than be advertised to the outside of the AS. In this case, the apply local-preference command does not take effect when EBGP neighbor relationships are set up.