< Home

apply local-preference

Function

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.

Format

apply local-preference preference

undo apply local-preference

Parameters

Parameter Description Value
preference Specifies the Local-Pref of BGP routes. The value is an integer ranging from 0 to 4294967295.

Views

Route-policy view

Default Level

2: Configuration level

Usage Guidelines

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.

Example

# Set the Local-Pref of BGP routes to 130.

<sysname> system-view
[sysname] route-policy policy permit node 10
[sysname-route-policy] apply local-preference 130
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >