Route Maps represent a powerful tool for manipulating ip routes and packets. Route maps are somewhat similar to Access Lists but are more complex and more powerful. This article describe the basics of route maps on Cisco devices, and what they are used for. Route maps are widely used by:
- Border Gateway Protocol (BGP);
- Route Redistribution;
- Policy Based Routing (PBR).
When a route map is applied it will check packets against a match with
match command. If a match occurs then an action can be done by using
set command. Every statement in a route map has a sequence number, default sequence number is 10. Each statement has a permit or deny parameter, which can have different effects in different situations. Any statement that has the same name is the part of the same Route Map. Each route map statement can contain one or several match or set statements. Let’s take an example:
route-map TEST deny 10 match ip address 50 route-map TEST permit 20 match ip address 60 70 set ip next-hop 10.10.10.10
In example above you see route map TEST. Numbers 10 and 20 are sequence numbers. This route map can be used in Policy Based Routing (PBR) where next hop address is set to 10.10.10.10. Numbers 50, 60 and 70 are Access Lists numbers, that route map will use to find out which packets to analyze.
When this route map is used by PBR, following will happen:
- If a match in first statement occurs, then next hop will remain unchanged and route map is not further analyzed;
- If a match in first stattement will not occur, next statement will be analyzed;
- If in second statement a match occurs, set command will take effect and next hop will be changed.
A match statement can have more than one criteria (like above criteria 60 and 70). If so, then a logical OR is applied, ie at least one of them must be true to consider this statement as a match.
If there are multiple match statements under the same sequence number, then a logical AND is applied, ie all of them must be true to consider this statement (for this sequence number) as a match.