(Optional) Configuring if-match Clauses
Context
An if-match clause defines matching rules related to route filters and attributes in a routing policy.
If no if-match clause is configured in a node of a routing policy, all routes match this node. If one or more if-match clauses are configured in a node, the relationship between the clauses is AND. This means that a route matches this node only when it matches all the if-match clauses in this node.
If multiple if-match as-path-filter, if-match community-filter, if-match extcommunity-filter, if-match interface, or if-match route-type clauses are configured, the relationship between these clauses is OR, such as if multiple if-match as-path-filter clauses are configured in a node. The relationship of the five clauses independently is AND, and the relationship between these clauses and other if-match clauses is also AND.
If an if-match clause defines a filter that is not configured, all routes match this if-match clause by default.
The if-match acl and if-match ip-prefix commands cannot be used together in the same node. When both the commands are used in a node, the most recently configured one overrides the previously configured one.
Procedure
- Run system-view
The system view is displayed.
- Run route-policy route-policy-name { permit | deny } node node
The routing policy view is displayed.
- Configure if-match clauses in any sequence for the routing policy based on network requirements.
Run if-match acl { acl-number | acl-name }
An if-match clause is configured to match the basic ACL.
Run if-match as-path-filter { as-path-filter-number &<1-16> | as-path-filter-name }
An if-match clause is configured to match AS_Path filters.
- Run any of the following commands as required to configure an if-match clause to match community filters:
- if-match community-filter { basic-comm-filter-num [ whole-match ] | adv-comm-filter-num } &<1-16>
- if-match community-filter comm-filter-name [ whole-match ]
Run if-match extcommunity-filter { { basic-extcomm-filter-num | adv-extcomm-filter-num } &<1-16> | extcomm-filter-name }
An if-match clause is configured to match extended community filters.
Run if-match extcommunity-list soo extcomm-filter-name
An if-match clause is configured to match the SoO extended community attribute.
Run if-match cost cost
Or run if-match cost { greater-equal greater-equal-value [ less-equal less-equal-value ] | less-equal less-equal-value }
An if-match clause is configured to match the cost of routes.
Run if-match preferencepreference
An if-match clause is configured to match the route preference.
Run if-match interface { interface-type interface-number } &<1-16>
An if-match clause is configured to match outbound interfaces of routes.
Run if-match ip { next-hop | route-source } { acl { acl-number | acl-name } | ip-prefix ip-prefix-name }
An if-match clause is configured to match the next-hop or source address of IPv4 routes.
Run if-match ipv6 { address | next-hop | route-source } { acl { acl-number | acl-name } | prefix-list ipv6-prefix-name }
An if-match clause is configured to match the destination, next-hop, or source address of IPv6 routes.
Run if-match ip-prefix ip-prefix-name
An if-match clause is configured to match the IP prefix list.
Run if-match mpls-label
An if-match clause is configured to match the MPLS label of routes.
Run if-match rd-filter rd-filter-number
An if-match clause is configured to match the RD filter.
- Run any of the following commands as required to configure an if-match clause to match routes:
Run if-match route-type { external-type1 | external-type1or2 | external-type2 | internal | nssa-external-type1 | nssa-external-type1or2 | nssa-external-type2 }
An if-match clause is configured to match a specified type of OSPF routes.
Run if-match route-type { is-is-level-1 | is-is-level-2 }
An if-match clause is configured to match a specified type of IS-IS routes.
Run if-match route-type { ibgp | ebgp }
An if-match clause is configured to match a specified type of BGP routes.
Run if-match tag tag
An if-match clause is configured to match the tag of routes.
Run if-match prefix mod mod-value equal mod-result
An if-match clause is configured to match the route prefix modulo operation result.
- Run commit
The configuration is committed.