
BGP Route Maps
explains the structure of a route map and how conditional matching and conditional actions can be combined to filter or manipulate routes.
- Route maps can filter networks much the same way as ACLs, but they also provide additional capability through the addition or modification of network attributes.
- To influence a routing protocol, a route map must be referenced from the routing protocol.
- Route maps are critical to BGP because they are the main component in modifying a unique routing policy on a neighbor-by-neighbor basis.
Route Map Components and Syntax
A route map has four components:
- Sequence number – Dictates the processing order of the route map.
- Conditional matching criteria – Identifies prefix characteristics (network, BGP path attribute, next hop, …)
- Processing action – Permits or denies the prefix.
- Optional action – Allows for manipulations, depending on how the route map is referenced on the router. Actions can include modification, addition, or removal of route characteristics.
A route map uses the command syntax: route-map route-map-name [permit | deny] [sequence-number]
- If a processing action is not provided, the default value permit is used.
- If a sequence number is not provided, the sequence number is incremented by 10 automatically.
- If a matching statement is not included, an implied all prefixes is associated with the statement.
- Processing within a route map stops after all optional actions have processed (if configured) after matching a conditional matching criterion.
Route Maps
Route Map Components and Syntax (example) The conditional matching criterion is based on network ranges specified in an ACL. Comments have been added to this example to explain the behavior of the route map in each sequence.
Route Map Conditional Matching
Command syntax for common methods for conditionally matching prefixes and their usage. Table 12-7 Conditional Match Options
Match Command | Description |
match as-path acl-number | Selects prefixes based on a regex query to isolate the ASN in the BGP |
path attribute (PA) AS path. The AS path ACLs are numbered 1-500. This | |
command allows for multiple match variables. | |
match ip address {acl-number | acl-name} | Selects prefixes based on network selection criteria defined in the ACL. |
This command allows for multiple match variables. | |
match ip address prefix-list prefix-list-name | Selects prefixes based on prefix selection criteria. This command allows |
for multiple match variables. | |
match local-preference local-preference | Selects prefixes based on the BGP attribute local preference. This |
command allows for multiple match variables. | |
match metric {1-4294967295 | external 1- | Selects prefixes based on a metric that can be exact, a range, or within |
4294967295}[+- deviation] | acceptable deviation. |
match tag tag-value | Selects prefixes based on a numeric tag (0 to 4294967295) that was set |
by another router. This command allows for multiple match variables. | |
Route Map Multiple Match Variables and Options
If there are multiple variables (ACLs, prefix lists, tags, and so on) configured for a specific route map sequence, only one variable must match for the prefix to qualify. The Boolean logic uses an OR operator for this configuration. In Example 12-4, sequence 10 requires that a prefix pass ACL-ONE or ACL-TWO. Notice that sequence 20 does not have a match statement, so all prefixes that are not passed in sequence 10 will qualify and are denied. If there are multiple match options configured for a specific route map sequence, both match options must be met for the prefix to qualify for that sequence. The Boolean logic uses an AND operator for this configuration. In Example 12-5, sequence 10 requires that the prefix match ACL-ONE and that the metric be a value between 500 and 600. If the prefix does not qualify for both match options, the prefix does not qualify for sequence 10 and is denied because another sequence does not exist with a permit action.
Route Map Complex Matching Problems
Route maps process using an order of evaluation: the sequence, conditional match criteria, processing action, and optional action in that order. Any deny statements in the match component are isolated and excluded from the route map sequence action. The prefix 172.16.1.0/24 is denied by ACL-ONE, which implies that there is not a match in sequences 10 and 20; therefore, the processing action (permit or deny) is not needed. Sequence 30 does not contain a match clause, so any remaining routes are permitted. The prefix 172.16.1.0/24 would pass on sequence 30 with the metric set to 20. The prefix 172.16.2.0/24 would match ACL-ONE and would pass in sequence 10.
Route Map Optional Actions
In addition to permitting the prefix to pass, route maps can modify route attributes. The table provides a brief overview of the most popular attribute modifications. Table 12-8 Route Map Set Actions
Match Command | Description |
set as-path prepend {as-number-pattern | | Prepends the AS path for the network prefix with the pattern |
last-as 1-10} | specified or from multiple iterations from a neighboring AS. |
set ip next-hop { ip-address | peer-address | | Sets the next-hop IP address for any matching prefix. BGP |
self } | dynamic manipulation uses the peer-address or self keywords. |
set local-preference 0-4294967295 | Sets the BGP PA local preference. |
set metric {+value | –value | value} | Modifies the existing metric or sets the metric for a route. |
(where value parameters are 0–4294967295) | |
set origin {igp | incomplete} | Sets the BGP PA origin. |
set tag tag-value | Sets a numeric tag (0–4294967295) for identification of |
networks by other routers | |
set weight 0-65535 | Set the BGP PA weight. |
Route Map continue Keyword
The route map is processed in order, and upon the first match, it executes the processing action, performs any optional action (if feasible), and stops processing. This prevents multiple route map sequences from processing. Adding the keyword continue to a route map allows the route map to continue processing other route map sequences. Example 12-7: The network prefix 192.168.1.1 matches in sequences 10, 20, and 30. Because the keyword continue was added to sequence 10, sequence 20 processes, but sequence 30 does not because a continue command was not present in sequence 20. The 192.168.1.1 prefix is permitted, and it is modified so that the metric is 20, with the next-hop address 10.12.1.1. Note: The continue command is not commonly used because it adds complexity when troubleshooting route maps. Other useful information: