if-match as-path-filter

Function

The if-match as-path-filter command sets a filtering rule that is based on the AS_Path filter.

The undo if-match as-path-filter command cancels the configuration.

By default, no filtering rule based on the AS_Path filter is set.

Format

if-match as-path-filter { apfIndex } &<1-16>

if-match as-path-filter apfName

undo if-match as-path-filter [ apfIndex ] &<1-16>

undo if-match as-path-filter apfName

Parameters

Parameter Description Value
apfIndex

Specifies the number of the AS_Path filter.

The value is an integer ranging from 1 to 256.

apfName

Specifies the name of an AS_Path filter.

The value is a string of 1 to 51 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.

Views

Route-policy view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
route-base write

Usage Guidelines

Usage Scenario

The AS_Path attribute is a proprietary attribute of BGP. The if-match as-path-filter command is applicable mainly to BGP routes. The ip as-path-filter command must be used to define an AS_Path filter so that the filtering rule based on this AS_Path filter can take effect. For example:

  • If the if-match as-path-filter 1 command is used but AS_Path filter 1 is not configured, all routes match the filtering rule.
  • If the if-match as-path-filter 1 command is used after the ip as-path-filter 1 permit *20 command is used, the BGP routes with the AS_Path attribute 20 are permitted.

    The if-match as-path-filter command is required when you need to configure a node to filter routes based on the AS_Path filter. After such a filtering rule is configured, apply the apply clauses to change the attributes of the routes that match the AS_Path filter.
  • Run the route-policy command to enter the Route-policy view.
  • A route-policy may consist of multiple nodes. The relationship between the nodes is "OR". The system matches a route against the nodes in sequence. If the route matches a node, the route matches the route-policy, and the system no longer matches it against other nodes.
  • Each node comprises a set of if-match and apply clauses. The if-match clauses define the filtering rules that are used to match certain route attributes. The relationship among if-match clauses of the same node that are based on different route attributes is AND. A route matches a node only when the route matches all the filtering rules specified in the if-match clauses of the node. The apply clauses specify actions. The relationship among if-match clauses of the same node that are based on the same route attribute is OR. The system matches routes against the if-match clauses in order. If a route matches an if-match clause, the system no longer matches the route against the rest if-match clauses. For example, the if-match community-filter 1 and if-match as-path-filter 1 configurations in node 10 are based on different route attributes. Therefore, the relationship among if-match clauses of this node is AND. The if-match community-filter 1 and if-match community-filter 2 configurations in node 20 are both based on the community attribute. Therefore, the relationship among if-match clauses of this node is OR. The apply clauses specify actions. If a route matches a node, the apply clauses set some attributes for the route.

Prerequisites

An AS_Path filter has been configured using the ip as-path-filter command.

Precautions

A maximum of 16 AS_Path filters can be configured in the if-match as-path-filter command. The relationship between these AS_Path filters is OR. Specifically, if a route matches one of these AS_Path filters, it matches the matching rules of the command.

Example

# Set the AS_Path filter numbered 2, and allow routes carrying AS 200 and AS 300. Then, define a route-policy named test, and enable the node 10 in this route-policy to define an if-match clause using the AS_Path filter 2.
<HUAWEI> system-view
[~HUAWEI] ip as-path-filter 2 permit _200_300
[*HUAWEI] route-policy test permit node 10
[*HUAWEI-route-policy] if-match as-path-filter 2
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >