The preference command sets a priority for EBGP routes, IBGP routes, or local BGP routes. BGP routes are configured with different priorities in different address family views.
The undo preference command restores the default setting.
By default, the priorities of EBGP routes, IBGP routes, and local BGP routes are all 255.
Parameter | Description | Value |
---|---|---|
external |
Specifies the priority of an EBGP route. An EBGP route is the optimal route learned from a peer outside the local AS. |
The value is an integer ranging from 1 to 255. The smaller the value is, the higher the priority is. |
internal |
Specifies the priority of an IBGP route. An IBGP route is a route learned from a peer inside the AS. |
The value is an integer ranging from 1 to 255. The smaller the value is, the higher the priority is. |
local |
Specifies the priority for summary and leaked routes. This parameter takes effect for the following routes:
|
The value is an integer ranging from 1 to 255. The smaller the value is, the higher the priority is. |
route-policy route-policy-name |
Specifies the name of a route-policy. |
The name is a string of 1 to 200 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
route-filter route-filter-name |
Specifies the name of a route-filter. |
The value is a string of 1 to 200 case-sensitive characters, spaces not supported. If parameters are included in the referenced route-filter, specify values for them in the format of (var1, var2, ...var8) behind the route-filter name. A maximum of eight parameters can be specified, and each value ranges from 1 to 200 characters. |
Usage Scenario
Running the preference command to set priorities for BGP routes affects route selection among BGP routes and routes of other routing protocols.
After a route-policy or route-filter is configured on a device, the device sets priorities only for the routes received from peers, which meet the matching rules. The routes that do not meet the rules use the default priority. The smaller the priority value, the higher the priority.Prerequisites
Create the route-policy first if the preference command uses the route-policy to set priorities.
Perform the following steps when the route-policy is used to set priorities:Configuration Impact
The preference route-policy command is mutually exclusive with the preference route-filter command.
Precautions
Currently, the peer route-policy or peer route-filter command cannot be used to apply a route-policy to setting priorities for BGP routes.
The preference command cannot configure a priority for routes imported using the network command or the import-route command. If a route is imported to BGP as a BGP route using the network or import-route command, the BGP route inherits the priority of the imported route. In this command, the local parameter specifies a priority for summary routes and leaked routes. This parameter takes effect for the following routes:<HUAWEI> system-view [~HUAWEI] ip vpn-instance vpn1 [*HUAWEI-vpn-instance-vpn1] ipv4-family [*HUAWEI-vpn-instance-vpn1-af-ipv4] route-distinguisher 100:1 [*HUAWEI-vpn-instance-vpn1-af-ipv4] vpn-target 111:1 both [*HUAWEI-vpn-instance-vpn1-af-ipv4] quit [*HUAWEI-instance-vpn1] quit [~HUAWEI] bgp 100 instance aa [~HUAWEI-bgp-instance-aa] ipv4-family vpn-instance vpn1 [*HUAWEI-bgp-instance-aa-vpn1] preference 2 2 20