< Home

if-match as-path-filter

Function

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

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

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

Format

if-match as-path-filter { as-path-filter-number &<1-16> | as-path-filter-name }

undo if-match as-path-filter [ as-path-filter-number &<1-16> | as-path-filter-name ]

Parameters

Parameter Description Value

as-path-filter-number

Specifies the number of the AS_Path filter. A maximum of 16 AS_Path filter numbers can be specified in the if-match as-path-filter command.

The value is an integer ranging from 1 to 256.

as-path-filter-name

Specifies the name of the AS_Path filter.

The name is a string of 1 to 51 case-sensitive characters without any space. The string cannot be all numbers.

NOTE:

When double quotation marks are used around the string, spaces are allowed in the string.

Views

Route-policy view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The AS_Path attribute is a proprietary attribute of BGP. The if-match as-path-filter command is applicable to only BGP routes. The ip as-path-filter command must be used to define an AS_Path filter so that the matching 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 are permitted, that is, all routes can match the matching 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 being 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-based matching rule. After such a matching rule is configured, you can apply the apply clauses to change the attributes of the routes that match the AS_Path filter-based matching rule.

Prerequisites

Before using the if-match as-path-filter command, you must use the ip as-path-filter command to configure an AS_Path filter.

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.

Creating an AS_Path filter before it is referenced is recommended. By default, nonexistent AS_Path filters cannot be referenced using the command. If the route-policy nonexistent-config-check disable command is run in the system view and a nonexistent AS_Path filter is referenced using the current command, all routes match the AS_Path filter.

Example

# Set the AS_Path filter numbered 2, and allow routing information to contain 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, which uses the AS_Path filter 2.

<sysname> system-view
[sysname] ip as-path-filter 2 permit _200_300
[sysname] route-policy test permit node 10
[sysname-route-policy] if-match as-path-filter 2
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >