Route Maps - Using route maps for policy-based routing  
 


In a complex network, where there are multiple paths for data to travel, it is often desirable to control the route the packets will take through the network. Route maps are often used to enhance the predictability of data flows in a complex environment.

Route maps are similar to access lists, and are used when the route that a packet takes needs to be altered. When a route map is applied to an interface, packets on that interface are tested against conditions that are configured using match commands. If the conditions are met, an action can be taken. Actions are defined using set commands and can be used to modify the packet or routes (this is the major difference between access lists and route maps).

Route maps are identified by a map name that is assigned when the route map is created. A route map may be composed of multiple lines each with a sequence number. Each line can have multiple match and set commands. A packet is compared to each line of the route map until there is a match, then the set actions for that line are applied to the packet similar to the way an access list is applied. Also like an access list, the last line of a route-map is an implicit deny.

Take the following example:

access-list 1 permit 192.168.1.1
access-list 2 permit 192.168.2.0 0.0.0.255

route-map test permit 10
match ip address 1
match route-type internal
set interface Serial0
!
route-map test permit 20
match ip address 2
set interface Null0


If this route map were configured on an interface, packets received would be tested against each line in order. For traffic to be passed to serial interface 0, it would have to have a source of 192.168.1.1 (note the access list), and the route would have to be internal (inter/intra area OSPF). Any traffic from the 192.168.2.X subnet would be sent to the Null interface.

To display configured route maps, the 'show route-map [map name]' command can be used. For a route map to be useful, it has to be applied to an interface. Use the command:

host(config)#int e0
host(config-if)#ip policy route-map test

This command applies the route map to Ethernet interface on the router. To see what route maps are applied to an interface, you can use the show ip policy command:

The 'debug ip policy' command can be used to view IP policy activity. The command allows you to see the effect of route maps on packets, and to troubleshoot problems with applied route maps. It is important to note that the debug command can utilize significant router resources, and should be used during low traffic periods.

Cisco documentation - Configuring Policy-Based Routing

Cisco documentation - Configuring IP Routing Protocol-Independent Features