Like ACLs, route maps can also be applied in many different scenarios. Route maps and ACLs have common characteristics. These characteristics are as follows:
- Route maps and ACLs are an ordered sequence of individual statements. Each individual sequence is configured with either a permit or deny result
- The evaluation of route maps or ACLs is based on a list scan, in a predetermined order, and an evaluation of the criteria of each statement that matches. This list scan is aborted once the first statement match is found and an action associated with the statement match is performed
- They are both generic mechanisms that can be used in multiple tasks. Criteria matches and match interpretation are dictated by the way they are applied. For example, the same route map applied to different tasks might be interpreted differently, as would be the case with an Access Control List applied to different tasks
While route maps and ACLs do share common characteristics, there are some notable differences between these two mechanisms. These differences are as follows:
- Route maps can, and often do, use ACLs as matching criteria. However, ACLs do not and cannot use route maps as match criteria
- While ACLs are simply used to permit or deny the matched criteria, route maps can be used to do the same and much more. For example, a route map could be configured to perform a certain action, e.g. set a route metric, following a successful match. Additionally to this route maps can also be used to match on other criteria, such as route tags and a specified route source, for example
- By design, each individual ACL ends with an implicit deny statement. However, this is not true for route maps and different actions will be taken depending on how the route map is applied. However, when used in route filtering and redistribution, route maps behave the same manner as an ACL. For example, if a route is not permitted in the route filtering configuration, the route will not be permitted. Likewise, if a route is not explicitly permitted during route redistribution, then the route will not be redistributed
In Cisco IOS software, route maps are configured using the route-map [name] [permit | deny] [sequence-number] global configuration command. The [name] is the configured route map name. Each individual route map must have a unique name.
When the route map is used to perform basic route filtering the [permit] keyword allows the matched criteria. When the route map is used for route redistribution, the [permit] keyword allows the route to be redistributed; however, if the specified criterion is not matched when this keyword is used, the next entry in the route map will be checked. If a route does not pass any of the match criteria for the set of route map entries, it is not redistributed.
The [deny] keyword simply denies the route, when using route filtering, or prevents the route from being redistributed, when used in route redistribution configuration. And finally, the optional [sequence-number]allows more than one permit or deny statement to be used in the same route map. The [sequence-number]determines the position of the route map entry in relation to other entries within the same route map.
Once a route map has been configured in global configuration mode, one or more match or set clauses can be configured. The following section describes the functions of these statements.
Route Map Match Clauses
Match clauses are used to match against predefined criteria, i.e. the conditions that must be met. Match clauses are configured by using the match subcommand in route map configuration mode. Cisco IOS software provides very granular matching capabilities, ranging from ACLs and IP prefix lists to the type of route, e.g. internal or external, and even from a particular source protocol, e.g. OSPF, EIGRP, and BGP. Following is a list of supported keywords that can be used in conjunction with route map match clauses:
| R2(config)#route-map MYMAP permit 5 R2(config-route-map)#match ? as-path Match BGP AS path list clns CLNS information community Match BGP community list extcommunity Match BGP/VPN extended community list interface Match first hop interface of route ip IP specific information ipv6 IPv6 specific information length Packet length local-preference Local preference for route metric Match metric of route mpls-label Match routes which have MPLS labels nlri BGP NLRI type policy-list Match IP policy list route-type Match route-type of route source-protocol Match source-protocol of route tag Match tag of route |
NOTE: Keep in mind that these options will vary across different versions of IOS software
Route Map Set Clauses
Set clauses are used to determine what happens a positive match has been made. Set clauses are configured using the set subcommand in route map configuration mode. Set clauses may be used to set route metrics, the type of route metric, e.g. External Type 1 or External Type 2, and even route tags that can be used to identify routes. Following is a list of supported keywords that can be used in conjunction with route map set clauses:
| R2(config)#route-map MYMAP permit 5 R2(config-route-map)#set ? as-path Prepend string for a BGP AS-path attribute automatic-tag Automatically compute TAG value clns OSI summary address comm-list set BGP community list (for deletion) community BGP community attribute dampening Set BGP route flap dampening parameters default Set default information extcommunity BGP extended community attribute interface Output interface ip IP specific information ipv6 IPv6 specific information level Where to import route local-preference BGP local preference path attribute metric Metric value for destination routing protocol metric-type Type of metric for destination routing protocol mpls-label Set MPLS label for prefix nlri BGP NLRI type origin BGP origin code tag Tag value for destination routing protocol traffic-index BGP traffic classification number for accounting vrf Define VRF name weight BGP weight for routing table |
NOTE: Keep in mind that these options will vary across different versions of IOS software