Route maps can filter networks much in the same way as access control lists or prefix lists, and much more. Route maps have additional capabilities such as allowing the modification or addition of network attributes in BGP.
To modify or add network attributes in BGP, a route-map must be referenced by the routing protocol.
This makes route maps critical in the operation of BGP as they are the preferred component to modifying a routing policy to one or more neighbours.
The route map consists of four main components, a sequence number conditional matching criteria, a processing action and a optional action.
To configure a route map on a Cisco router, it uses the command syntax route-map
followed by chosen name of the route map. The next part of the command is whether to permit
or deny
which is the processing action. Finally the sequence number is added to the end of the statement, another component of the route map.
route-map testing permit 10
! Processing action and sequence
match ip address access-control-one ! Matching statement
set metric 75 ! Processing Action
If a permit
or deny
action is not specified, permit
is specified by default.
If a sequence number is not specified, it is incremented by 10 automatically.
If a matching statement is not provided, it is implied all prefixes are affected by the statement.
Processing in a route map is stopped after all optional actions have been processed after matching a statement.
Examples of Conditional Matching
match as-path
Selects prefixes based on a regex query to isolate the ASN in the BGP path attribute. AS Path ACLs are numbered between 1 to 500.
match ip address
Selects prefixes based on network selection criteria as specified in an ACL.
match ip address prefix-list
Selects prefixes based on network selection criteria as specified in a prefix list.
match local-preference
Selects prefixes based on the local preference BGP attribute.
match metric
Selects prefixes based on a metric value that is exact, part of a range or within a specified deviation.
match tag
Selects prefixes that are matched by numeric tag that was set by another router.
Multiple Conditional Matching
OR Matching
If multiple variables are configured for a specific sequence on a single line, only one needs to match for the sequence to match, the same as an OR statement.
route-map TEST permit 10 match ip address ACL-1 ACL-2
AND Matching
If multiple match statements are configured on a single sequence number, then they all need to match in order for the route-map to ‘permit’ the sequence.
route-map TEST permit 10 match ip address ACL-1 match metric 500
Complicated Matching
A mix of permit and deny statements can be used with route maps.
ip access-list extended ACL-TEST deny 192.168.1.0 0.0.0.255 permit 192.168.2.0 0.0.0.255 route-map testing permit 10 match ip address ACL-TEST route-map testing deny 20 match ip address ACL-TEST route-map testing permit 30 set metric 20
The above example could end up being denied by 10 or 20 via the ACL with an IP address from 192.168.1.20, so no processing by the route map (it’s permit or denys) would be required. It would pass on sequence 30 though, and have its metric set to 30.
An address from 192.168.2.1 would pass sequence 10, so would not need to evaluate as far as statement 30.
Route maps will process in a certain order: Sequence, conditional match criteria, action, and then optional action. If there is a deny statement within the match component, they are isolated from the sequence actions permit or deny.
Examples of Additional Actions
Route maps can modify routing attributes, here are some examples:
set as-path prepend
Prepends the AS path with the pattern specified
set ip next hop
Sets the ip address next-hop for any matching prefix
set local preference
Sets the BGP prefix addresses local preference
set metric
Modifies the existing metric or sets a metric for a route
set origin
Sets the path attribute origin
set tag
Sets a numeric tag for identification of the route by other routers
set weight
Sets the path attribute weight
continue Keyword
In a route map, the processing behaviour carries out the sequences in order and with the first match, executes the processing action and any additional optional actions, then stops.
If the continue keyword
is added, it will allow the router to continue working its way down the sequential list to process other route-map sequences.
Leave a Reply