if-match cost

Function

The if-match cost command sets a filtering rule that is based on the route cost.

The undo if-match cost command cancels the configuration.

By default, no filtering rule based on the route cost is set.

Format

if-match cost cost

if-match cost greater-equal greater-equal-value less-equal less-equal-value

if-match cost { greater-equal greater-equal-value | less-equal less-equal-value }

undo if-match cost

Parameters

Parameter Description Value
cost

Specifies the route cost. Route costs can be changed to prevent routing loops.

The value is an integer ranging from 0 to 4294967295.

greater-equal greater-equal-value

Specifies the minimum value of route cost.

The value is an integer ranging from 0 to 4294967294.

less-equal less-equal-value

Specifies the maximum value of route cost.

The value is an integer ranging from 1 to 4294967295.

less-equal-value is demanded to be greater than greater-equal-value.If greater-equal is specified, but less-equal is not, the maximum value 4294967295 is used as less-equal. If less-equal is specified, but greater-equal is not, the minimum value 0 is used as greater-equal.

Views

Route-policy view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
route-base write

Usage Guidelines

Usage Scenario

You can use the if-match cost command to configure a node to filter routes based on the route cost. After such a filtering rule is configured, you can apply the apply clauses to change the attributes of the routes that match the filtering rule.

  • 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

A route-policy has been configured using the route-policy command.

Configuration Impact

When you filter routes based on the cost, only the routes that match the filtering conditions can match the route-policy.

Example

# Match the route with the cost 8.
<HUAWEI> system-view
[~HUAWEI] route-policy policy permit node 10
[*HUAWEI-route-policy] if-match cost 8
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >