The default local-preference command configures the default local preference (Local_Pref) for BGP.
The undo default local-preference command restores the default value.
By default, the Local_Pref of BGP is 100.
| Parameter | Description | Value |
|---|---|---|
preference |
Specifies the default Local_Pref for BGP. |
It is an integer ranging from 0 to 4294967295. The greater the value is, the higher the preference is. |
BGP view, BGP-IPv4 unicast address family view, BGP-IPv6 unicast address family view, BGP-VPN instance IPv4 address family view, BGP-VPN instance IPv6 address family view, BGP-VPNv4 address family view, BGP-VPN-Target address family view
Usage Scenario
The Local_Pref attribute is used to determine an optimal route for traffic before traffic leaves an AS. When the router that runs BGP has multiple routes to the same destination, the router selects the route with the highest Local_Pref as the optimal route. Please configure the Local_Pref attribute on the devices through which traffic will leave an AS.
Configuration Impact
If the router is already configured with a default Local_Pref for BGP routes, the configuration of a new default Local_Pref will override the previous configuration and the new default Local_Pref will overwrite the previous one.
Precautions
The Local_Pref is exchanged only between IBGP peers and is not advertised to other ASs.
# Set the default Local_Pref of BGP to 200.
<sysname> system-view
[sysname] bgp 100
[sysname-bgp] ipv4-family unicast
[sysname-bgp-af-ipv4] default local-preference 200
# Set the default Local_Pref of BGP routes in the specified IPv6 VPN instance to 200.
<sysname> system-view
[sysname] bgp 100
[sysname-bgp] ipv6-family vpn-instance vpna
[sysname-bgp6-vpna] default local-preference 200
# Set the Local_Pref of all BGP VPNv6 routes on the local router to 100.
<sysname> system-view
[sysname] bgp 100
[sysname-bgp] ipv6-family vpnv6
[sysname-af-vpnv6] default local-preference 100