if-match ip-prefix

Function

The if-match ip-prefix command sets a matching rule that is based on the IP prefix list.

The undo if-match ip-prefix command cancels the configuration.

By default, no matching rule based on the IP prefix list is set.

Format

if-match ip-prefix ip-prefix-name

undo if-match ip-prefix ip-prefix-name

Parameters

Parameter Description Value
ip-prefix-name Specifies the name of the IP prefix list. The name is a string of 1 to 169 case-sensitive characters, with 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

Usage Guidelines

Usage Scenario

After an IP prefix list is configured as a matching rule of a routing policy on a device, the device matches routes by using the IP prefix list, and permits or denies the routes that match the IP prefix list.

The ip ip-prefix command must be used to configure an IP prefix so that the matching rule configured through the if-match ip-prefix command can take effect. For example:

  • If the if-match ip-prefix p1 command is used but the IP prefix named p1 is not configured, all routes are permitted.
  • If the if-match ip-prefix p1 command is used after the ip ip-prefix p1 permit 1.1.1.1 32 command is used, the routes with the IP prefix being 1.1.1.1 and the mask being 32 are permitted.

Prerequisites

The if-match ip-prefix command can be used only after the route-policy command is used.

Configuration Impact

When you filter routes based on the IP prefixes, the routes that match the matching rule are permitted and the routes that do not match the matching rule are denied.

Precautions

The if-match ip-prefix and if-match acl commands are mutually exclusive. If you run the if-match acl command after running the if-match ip-prefix command, the configuration of the if-match acl command overrides the configuration of the if-match ip-prefix command.

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

Example

# Set a matching rule based on the IP prefix list named p1.

<sysname> system-view
[sysname] route-policy policy permit node 10
[sysname-route-policy] if-match ip-prefix p1
Related Topics
display route-policy
if-match acl
ip ip-prefix
route-policy

Huawei Proprietary and Confidential
Copyright © Huawei Technologies Co., Ltd.