Routing Policy Match Conditions
A match condition defines the criteria that a route must match. You can define one or more match conditions. If a route matches all match conditions, one or more actions are applied to the route.
Match conditions fall into two categories: standard and extended. In general, the extended match conditions include criteria that are defined separately from the routing policy (AS path regular expressions, communities, and prefix lists) and are more complex than standard match conditions. The extended match conditions provide many powerful capabilities. The standard match conditions include criteria that are defined within a routing policy and are less complex than the extended match conditions, also called named match conditions.
Table 1 describes each match condition, including its category, when you typically use it, and any relevant notes about it. For more information about match conditions, see Configuring Match Conditions in Routing Policy Terms.
Table 1: Match Conditions
Match Condition | Category | When to Use | Notes |
|---|---|---|---|
AS path regular expression—A combination of AS numbers and regular expression operators. | Extended | (BGP only) Match a route based on its AS path. (An AS path consists of the AS numbers of all routers a packet must go through to reach a destination.) You can specify an exact match with a particular AS path or a less precise match. | You use regular expressions to match the AS path. |
Community—A group of destinations that share a property. (Community information is included as a path attribute in BGP update messages.) | Extended | Match a group of destinations that share a property. Use a routing policy to define a community that specifies a group of destinations you want to match and one or more actions that you want taken on this community. | Actions can be performed on the entire group. You can create multiple communities associated with a particular destination. You can create match conditions using regular expressions. |
Prefix list—A named list of IP addresses. | Extended | Match a route based on prefix information. You can specify an exact match of a particular route only. | You can specify a common action only for all prefixes in the list. |
Route list—A list of destination prefixes. | Extended | Match a route based on prefix information. You can specify an exact match of a particular route or a less precise match. | You can specify an action for each prefix in the route list or a common action for all prefixes in the route list. |
Standard—A collection of criteria that can match a route. | Standard | Match a route based on one of the following criteria: area ID, color, external route, family, instance (routing), interface name, level number, local preference, metric, neighbor address, next-hop address, origin, preference, protocol, routing table name, or tag. | None. |
Subroutine—A routing policy that is called repeatedly from another routing policy. | Extended | Use an effective routing policy in other routing policies. You can create a subroutine that you can call over and over from other routing policies. | The subroutine action influences but does not necessarily determine the final action. For more information, see How a Routing Policy Subroutine Is Evaluated. |
Each term can consist of two statements, from and to, that define match conditions:
- In the from statement, you define the criteria that an incoming route must match. You can specify one or more match conditions. If you specify more than one, all conditions must match the route for a match to occur.
- In the to statement, you define the criteria that an outgoing route must match. You can specify one or more match conditions. If you specify more than one, all conditions must match the route for a match to occur.
The order of match conditions in a term is not important, because a route must match all match conditions in a term for an action to be taken.
Table 2 summarizes key routing policy match conditions.
Table 2: Summary of Key Routing Policy Match Conditions
Match Condition | Description |
|---|---|
aggregate-contributor | Matches routes that are contributing to a configured aggregate. This match condition can be used to suppress a contributor in an aggregate route. |
area area-id | Matches a route learned from the specified OSPF area during the exporting of OSPF routes into other protocols. |
as-path name | Matches the name of the path regular expression of an autonomous systems (AS). BGP routes whose AS path matches the regular expression are processed. |
color preference | Matches a color value. You can specify preference values that are finer-grained than those specified in the preference match conditions. The color value can be a number from 0 through 4,294,967,295 (232 – 1). A lower number indicates a more preferred route. |
community | Matches the name of one or more communities. If you list more than one name, only one name needs to match for a match to occur. (The matching is effectively a logical OR operation.) |
external [type metric-type] | Matches external OSPF routes, including routes exported from one level to another. In this match condition, type is an optional keyword. The metric-type value can be either 1 or 2. When you do not specify type, this condition matches all external routes. |
interface interface-name | Matches the name or IP address of one or more router interfaces. Use this condition with protocols that are interface-specific. For example, do not use this condition with internal BGP (IBGP). Depending on where the policy is applied, this match condition matches routes learned from or advertised through the specified interface. |
internal | Matches a routing policy against the internal flag for simplified next-hop self policies. |
level level | Matches the IS-IS level. Routes that are from the specified level or are being advertised to the specified level are processed. |
local-preference value | Matches a BGP local preference attribute. The preference value can be from 0 through 4,294,967,295 (232 – 1). |
metric metric metric2 metric | Matches a metric value. The metric value corresponds to the multiple exit discriminator (MED), and metric2 corresponds to the IGP metric if the BGP next hop runs back through another route. |
neighbor address | Matches the address of one or more neighbors (peers). For BGP export policies, the address can be for a directly connected or indirectly connected peer. For all other protocols, the address is for the neighbor from which the advertisement is received. |
next-hop address | Matches the next-hop address or addresses specified in the routing information for a particular route. For BGP routes, matches are performed against each protocol next hop. |
origin value | Matches the BGP origin attribute, which is the origin of the AS path information. The value can be one of the following:
|
preference preference preference2 preference | Matches the preference value. You can specify a primary preference value (preference) and a secondary preference value (preference2). The preference value can be a number from 0 through 4,294,967,295 (232 – 1). A lower number indicates a more preferred route. |
protocol protocol | Matches the name of the protocol from which the route was learned or to which the route is being advertised. It can be one of the following: aggregate, bgp, direct, dvmrp, isis, local, ospf, pim-dense, pim-sparse, rip, ripng, or static. |
route-type value | Matches the type of route. The value can be either external or internal. |