To define the conditions for policy routing, use the route-map command in Global Configuration mode and the match and set commands in Route Map Configuration Mode. To delete an entry, use the no form of this command.
Syntax
route-map map-tag [sequence-number]
no route-map map-tag [sequence-number]
Parameters
-
map-tag—A meaningful name for the route map. The redistribute router configuration command uses this name to reference this route
map. Multiple route maps may share the same map tag name.
-
sequence-number—Positive integer number that indicates the position a new route map will have in the list of route maps already configured
with the same name. If the parameter is used with the no form of this command, the position of the route map should be deleted. If the parameter is omitted in the route-map command then a value of 10 is applied. If the parameter is omitted in the no format then all route maps sharing same map tag name are deleted.
Default Configuration
Conditions for policy routing is not configured.
Command Mode
Global Configuration mode
User Guidelines
Use the route-map command to enter route-map configuration mode. The purpose of the route map command is to define policy routing.
The match commands specify the conditions under which policy routing occurs and the set commands specify the routing actions to perform if the criteria enforced by the match commands are met:
-
If a outed packet matches to an ACL with the permit action the packet is forwarded by the set command (policy based routing).
-
If a outed packet matches to an ACL with the deny action the frame is forwarded by the Forwarding table (regular routing).
A route map can have several sections configured by separate route-map commands with the same map tag. When a routed packet is checked by a route map the first section which criteria is forced
is applied. If there is no matched section the obvious shortest path using the Forwarding Table is applied.
Examples
Example 1. The following example gives an example of a route map with one section. TCP packet sent to subnet 156.12.5.0/24 are passed
to the next hop 56.1.1.1.
switchxxxxxx(config)# ip access-list extended pr-acl1
switchxxxxxx(config-ip-al)# permit tcp any any 156.12.5.0 0.0.0.255 any
switchxxxxxx(config-ip-al)# exit
switchxxxxxx(config)# route-map pbr
switchxxxxxx(config-route-map)# match ip address access-list pr-acl1
switchxxxxxx(config-route-map)# set ip next-hop 56.1.1.1
switchxxxxxx(config-route-map)# exit
switchxxxxxx(config)# interface vlan 1
switchxxxxxx(config-if)# ip policy route-map pbr
switchxxxxxx(config-if)# exit
Example 2. The following example gives an example of a route map with two sections. TCP packet sent to subnet 156.12.5.0/24 are passed
to the next hop 56.1.1.1 and CP packet sent to subnet 156.122.5.0/24 are passed to the next hop 50.1.1.1.
switchxxxxxx(config)# ip access-list extended pr-acl1
switchxxxxxx(config-ip-al)# permit tcp any any 156.12.5.0 0.0.0.255 any
switchxxxxxx(config-ip-al)# exit
switchxxxxxx(config)# ip access-list extended pr-acl2
switchxxxxxx(config-ip-al)# permit tcp any any 156.122.5.0 0.0.0.255 any
switchxxxxxx(config-ip-al)# exit
switchxxxxxx(config)# route-map pbr 10
switchxxxxxx(config-route-map)# match ip address access-list pr-acl1
switchxxxxxx(config-route-map)# set ip next-hop 56.1.1.1
switchxxxxxx(config-route-map)# exit
switchxxxxxx(config)# route-map pbr 20
switchxxxxxx(config-route-map)# match ip address access-list pr-acl2
switchxxxxxx(config-route-map)# set ip next-hop 50.1.1.1
switchxxxxxx(config-route-map)# exit
switchxxxxxx(config)# interface vlan 1
switchxxxxxx(config-if)# ip policy route-map pbr
switchxxxxxx(config-if)# exit