Policy Based Routing PBR
Policy Based Routing PBR
Note • For complete syntax and usage information for the commands used in this chapter, see these
publications:
http://www.cisco.com/en/US/products/ps9536/prod_command_reference_list.html
http://www.cisco.com/en/US/products/ps11845/prod_command_reference_list.html
http://www.cisco.com/en/US/products/ps11846/prod_command_reference_list.html
• Cisco IOS Release 15.0SY supports only Ethernet interfaces. Cisco IOS Release 15.0SY does not
support any WAN features or commands.
Tip For additional information about Cisco Catalyst 6500 Series Switches (including configuration examples
and troubleshooting information), see the documents listed on this page:
http://www.cisco.com/en/US/products/hw/switches/ps708/tsd_products_support_series_home.html
Participate in the Technical Documentation Ideas forum
Note IPv4 PBR recursive next-hop with reload balancing is not supported on Supervisor Engine 720.
Note Local PBR does not support routing of distributed Netflow Data Export.
PBR Overview
PBR is an alternative to routing protocols and allows you to configure a policy for unicast traffic flows,
which provides more control over routing than a routing protocol does and avoids the need to configure
interface-level traffic classification. PBR can route unicast traffic along a different path than a routing
protocol would use. PBR can provide:
• Equal access
• Protocol-sensitive routing
• Source-sensitive routing
• Routing based on interactive rather than batch traffic
Note For information about Multi-VRF Selection Using Policy Based Routing (PBR VRF), see this document:
http://www.cisco.com/en/US/docs/ios/mpls/configuration/guide/mp_mltvrf_slct_pbr.html
Configuring PBR
To configure PBR on an interface, use the following commands beginning in global configuration mode:
Command Purpose
Step 1 Router(config)# route-map map-tag [permit | deny] Defines a route map to control where packets are
[sequence-number] output. This command puts the router into route-map
configuration mode.
Step 2 Router(config-route-map)# match length min max Specifies the match criteria.
Router(config-route-map)# match ip address Although there are many route-map matching
{access-list-number | name} [...access-list-number | options, here you can specify only length and/or ip
name] address.
• length matches the Level 3 length of the packet.
• ip address matches the source or destination IP
address that is permitted by one or more standard
or extended access lists.
If you do not specify a match command, the route
map applies to all packets.
Step 3 Router(config-route-map)# set ip precedence [number Specifies the action(s) to take on the packets that
| name] match the criteria. You can specify any or all of the
Router(config-route-map)# set ip df
following:
• precedence: Sets precedence value in the IP
Router(config-route-map)# set ip vrf vrf_name
header. You can specify either the precedence
Router(config-route-map)# set ip next-hop ip-address number or name.
[... ip-address] • df: Sets the ‘Don’t Fragment’ (DF) bit in the ip
Router(config-route-map)# set ip next-hop recursive
header.
ip-address [... ip-address] • vrf: Sets the VPN Routing and Forwarding
(VRF) instance.
Router(config-route-map)# set interface
interface-type interface-number [... type number] • next-hop: Sets next hop to which to route the
packet.
Router(config-route-map)# set ip default next-hop
ip-address [... ip-address] • next-hop recursive: Sets next hop to which to
route the packet if the hop is to a router which is
Router(config-route-map)# set default interface
not adjacent.
interface-type interface-number [... type ...number]
• interface: Sets output interface for the packet.
• default next-hop: Sets next hop to which to
route the packet if there is no explicit route for
this destination.
• default interface: Sets output interface for the
packet if there is no explicit route for this
destination.
Command Purpose
Step 4 Router(config-route-map)# interface interface-type Specifies the interface, and puts the router into
interface-number interface configuration mode.
Step 5 Router(config-if)# ip policy route-map map-tag Identifies the route map to use for PBR. One interface
can have only one route map tag; but you can have
several route map entries, each with its own sequence
number. Entries are evaluated in order of their
sequence numbers until the first match occurs. If no
match occurs, packets are routed as usual.
The set commands can be used in conjunction with each other. They are evaluated in the order shown in
Step 3 in the previous task table. A usable next hop implies an interface. Once the local router finds a
next hop and a usable interface, it routes the packet.
Command Purpose
Router(config)# ip local policy route-map map-tag Identifies the route map to use for local PBR.
Note PBR supports only one recursive next-hop IP address per route-map entry.
Example:
Router# configure terminal
Step 3 access-list permit source Configures an access list. The example configuration
permits any source IP address that falls within the
10.60.0.0. 0.0.255.255 subnet.
Example:
Router(config)# access-list 101 permit
10.60.0.0 0.0.255.255
Step 4 route-map map-tag Enables policy routing and enters route-map configuration
mode.
Example:
Router(config)# route-map abccomp
Step 5 set ip next-hop ip-address Sets a next-hop router IP address.
Note Set this IP address separately from the next-hop
Example: recursive router configuration.
Router(config-route-map)# set ip next-hop
10.10.1.1
Step 6 set ip next-hop {ip-address [...ip-address] | Sets a recursive next-hop IP address.
recursive ip-address}
Note This configuration does not ensure that packets get
routed using the recursive IP address if an
Example: intermediate IP address is a shorter route to the
Router(config-route-map)# set ip next-hop destination.
recursive 10.20.3.3
Step 7 match ip address access-list-number Sets an access list to be matched.
Example:
Router(config-route-map)# match ip address 101
Step 8 end Exits route-map configuration mode and returns to
privileged EXEC mode.
Example:
Router(config-route-map)# end
Note The examples shown below involve the use of the access-list command (ACL). The log keyword should
not be used with this command in policy-based routing (PBR) because logging is not supported at the
interrupt level for ACLs.
Tip For additional information about Cisco Catalyst 6500 Series Switches (including configuration examples
and troubleshooting information), see the documents listed on this page:
http://www.cisco.com/en/US/products/hw/switches/ps708/tsd_products_support_series_home.html
Participate in the Technical Documentation Ideas forum