preference (BGP multi-instance VPN instance IPv4 address family view)

Function

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.

Format

preference { external internal local | route-policy route-policy-name }

preference route-filter route-filter-name

undo preference

Parameters

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:

  • Manually summary routes generated using the aggregate (BGP) command.
  • Automatically summary routes generated using the summary automatic command.
  • Routes generated through remote route leaking.
  • Routes generated through local route leaking.

    For details about these routes, see.

    Precautions.

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.

Views

BGP multi-instance VPN instance IPv4 address family view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
bgp write

Usage Guidelines

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:

  • Use the route-policy command to create the route-policy, and enter the route-policy view.
  • Configure the if-match clause to set the matching rules for routes. The relationship between the if-match clauses in a node of a route-policy is "AND". A route must match all the rules before the action defined by the apply clause is taken. If no if-match clause is specified, all routes will match the node in the route-policy.
  • Use the apply preference command to set priorities for routes that pass the filtering.

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:

  • Manually summary routes generated using the aggregate (BGP) command. The Route type field for this type of route displays Aggregated route.
  • Automatically summary routes generated using the summary automatic command. The route type for these routes displays Summary automatic route.
  • Routes generated through remote route leaking. The route type for these routes displays Remote-Cross route.
  • Routes generated through local route leaking. The route type for these routes displays Local-Cross route.

Example

# Set the priority to 2 for EBGP routes, 2 for IBGP routes, and 20 for local BGP 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
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >