The route-policy command creates a route-policy and enters the route-policy view.
The undo route-policy command deletes the created route-policy.
By default, no route-policy is created.
route-policy route-policy-name { permit | deny } node node
undo route-policy route-policy-name [ node node ]
| Parameter | Description | Value |
|---|---|---|
| route-policy-name | Specifies the name of the route-policy. | The name is a string of 1 to 40 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
| permit | Specifies the matching mode of the route-policy as permit. In permit mode, a route matches all the if-match clauses, the route matches the route-policy and the actions defined by the apply clause are performed on the route. Otherwise, the route continues to match the next entry. | - |
| deny | Specifies the matching mode of the route-policy as deny. In deny mode, if a route matches all the if-match clauses, the route fails to match the route-policy and cannot match the next node. | - |
| node node | Specifies the index of the node in the route-policy. | The value is an integer ranging from 0 to 65535. When the route-policy is used to filter routes, the node with the smaller value of node is matched first. |
Usage Scenario
A route-policy is used to filter routes and set route attributes for the routes that match the route-policy. A route-policy consists of multiple nodes. One node can be configured with multiple if-match and apply clauses.
The if-match clauses define matching rules for this node, and the apply clauses define behaviors for the routes that match the rules. The relationship between the if-match clauses is "AND". That is, a route must match all the if-match clauses. The relationship between the nodes of a route-policy is "OR". That is, if a route matches one node, the route matches the route-policy. If the route does not match any node, the route fails to match the route-policy.
Precautions
After a route-policy is configured, by default, the RM immediately notifies each protocol to apply the route-policy to filter routes. To delay applying a route-policy, you need to run the route-policy-change notify-delay command to set the delay for applying the route-policy.
You can run the display route-policy command to view the number of routes that match and do not match the route-policy.
Before you run the undo route-policy command to delete a route-policy that is referenced by another command, delete the reference configuration.
If an if-match clause of a route-policy defines an ip-prefix-based filtering rule, the filtering rule applies to IPv4 prefixes, not to IPv6 prefixes, and IPv6 prefixes match the filtering rule by default. If IPv6 prefixes also need to be filtered, add an ipv6-prefix-based if-match clause. Similarly, if an if-match clause of a route-policy defines an ipv6-prefix-based filtering rule, the filtering rule applies to IPv6 prefixes, not to IPv4 prefixes, and IPv4 prefixes match the filtering rule by default. If IPv4 prefixes also need to be filtered, add an ip-prefix-based if-match clause.
# Configure the route-policy named policy1 whose node number is 10 and the matching mode is permit.
<sysname> system-view
[sysname] ip ip-prefix prefix-a index 10 permit 172.17.1.0 24
[sysname] route-policy policy1 permit node 10
[sysname-route-policy] if-match ip-prefix prefix-a
[sysname-route-policy] apply cost 100