Policy-Based Routing

The Policy-Based Routing feature is a process whereby a device puts packets through a route map before routing the packets. The route map determines which packets are routed next to which device. Policy-based routing is a more flexible mechanism for routing packets than destination routing.

Finding Feature Information

Your software release may not support all the features documented in this module. For the latest caveats and feature information, see Bug Search Tool and the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the feature information table.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/​go/​cfn. An account on Cisco.com is not required.

Information About Policy-Based Routing

Policy-Based Routing

Policy-based routing is a process whereby the device puts packets through a route map before routing them. The route map determines which packets are routed next to which device. You might enable policy-based routing if you want certain packets to be routed in a certain way other than the obvious shortest path. Possible applications for policy-based routing are to provide equal access, protocol-sensitive routing, source-sensitive routing, routing based on interactive versus batch traffic, and routing based on dedicated links. Policy-based routing is a more flexible mechanism for routing packets than destination routing.

To enable policy-based routing, you must identify which route map to use for policy-based routing and create the route map. The route map itself specifies the match criteria and the resulting action if all of the match clauses are met.

To enable policy-based routing on an interface, indicate which route map the device should use by using the ip policy route-map map-tag command in interface configuration mode. A packet arriving on the specified interface is subject to policy-based routing except when its destination IP address is the same as the IP address of the device’s interface. This ip policy route-map command disables fast switching of all packets arriving on this interface.

To define the route map to be used for policy-based routing, use the route-map map-tag [permit] [sequence-number] global configuration command.

To define the criteria by which packets are examined to learn if they will be policy-based routed, use the match ip address {access-list-number | access-list-name} command or both in route map configuration mode. No match clause in the route map indicates no packet match.

To display the cache entries in the policy route cache, use the show ip cache policy command.


Note


PBR is supported only in a video template.


Restrictions for Policy-Based Routing

  • The following command is not supported:
    ip local policy route-map <route-map_name>

    Note


    Local Policy based routing is not supported.
  • The following ACL statement is not supported:
    permit ip any any

    Note


    Use a specific prefix match for policy-based routing to work.


  • The router does not support deny access control entries (ACE) in the access-lists when configured under route maps.

  • If there is no match criteria in the route map, the traffic cannot be enabled for policy-based routing.

How to Configure Policy-Based Routing

Configuring Policy-Based Routing

SUMMARY STEPS

    1.    enable

    2.    configure terminal

    3.    sdm prefer video

    4.    ip access-list extended <name>

    5.    permit protocol source [source-wildcard] destination [destination-wildcard]

    6.    exit

    7.    Route-map <route_map_name> permit <sequence_number>

    8.    match ip address <match_criteria_name>

    9.    set ip next-hop <ip_address> set ip vrf <vrf_name> next-hop <ip_address> set vrf <vrf_name>

    10.    exit

    11.    interface type number

    12.    ip policy route-map <route_map_name>

    13.    exit


DETAILED STEPS
     Command or ActionPurpose
    Step 1 enable


    Example:
    Router> enable
    
     

    Enables privileged EXEC mode.

    • Enter your password if prompted.

     
    Step 2 configure terminal


    Example:
    Router# configure terminal
     

    Enters global configuration mode.

     
    Step 3sdm prefer video


    Example:
    Router(config)#sdm prefer video
     
    Configures the video mode.
    Note   

    This requires a reload of the system. The configuration of the following steps will only be effective after the SDM template is changed to video template.

     
    Step 4 ip access-list extended <name>


    Example:
    Router(config)#ip access-list extended pbr-acl1
     

    Configures an Extended ACL named "pbr-acl1" and enters extended-acl configuration mode.

     
    Step 5 permit protocol source [source-wildcard] destination [destination-wildcard]


    Example:
    Router(config-ext-nacl)#permit ip 10.0.0.0 0.255.255.255 200.0.0.0 0.255.255.255
     

    Creates a match statement to match the specified source & destination IP address.

     
    Step 6 exit


    Example:
    Router(config-ext-nacl)#exit
     

    Returns to global configuration mode.

     
    Step 7 Route-map <route_map_name> permit <sequence_number>


    Example:
    Router(config)#route-map pbr permit 10
     

    Creates a Route-map statement named "pbr" for redistributing routes from one routing protocol into another routing protocol or enables policy-based routing and enters route-map configuration mode.

     
    Step 8 match ip address <match_criteria_name>


    Example:
    Router(config-route-map)#match ip address pbr-acl1
     

    Defines the match criteria by which packets are examined to learn if they will be policy-based routed.

     
    Step 9 set ip next-hop <ip_address> set ip vrf <vrf_name> next-hop <ip_address> set vrf <vrf_name>


    Example:
    Router(config-route-map)#set ip next-hop 30.0.0.2
    Router(config-route-map)#set ip vrf vrf1 next-hop 30.0.0.1
    Router(config-route-map)#set vrf vrf1
    
     

    Specifies where to output packets that pass a match clause of a route map for policy routing.

     
    Step 10 exit


    Example:
    Router(config-route-map)#exit
    
     

    Returns to global configuration mode.

     
    Step 11 interface type number


    Example:
    Router(config)#interface Gi0/0/10
    
     

    Configures an interface type and enters interface configuration mode.

     
    Step 12 ip policy route-map <route_map_name>


    Example:
    Router(config-if)#ip policy route-map pbr
    
     

    Identifies a route map to use for policy routing on an interface.

     
    Step 13 exit


    Example:
    Router(config-if)#exit
    
     

    Returns to global configuration mode.

     

    Verifying Policy-Based Routing

    Use this command to verify that the SDM template is changed to video template.

    show sdm prefer current

    PE1#show sdm prefer current 
    The current template is "video" template

    Use this command to display the cache entries in the policy route cache.

    show ip cache policy

    CE1#show ip policy
    Interface      Route map
    Gi0/0/10       equal-access
    CE1#
    

    Configuration Examples for Policy-Based Routing

    This section shows sample configuration for Policy-Based Routing.

    Example: Policy-Based Routing

    The following is a sample configuration for Policy-Based Routing.
    Device# conf t
    Device(config)# access-list 1 permit host 10.1.1.1
    Device(config)# access-list 2 permit host 172.17.2.2
    Device(config)# exit
    
    Device# conf t
    Device(config)# route-map equal-access permit 10
    Device(config-route-map)# match ip address 1
    Device(config-route-map)# set ip next-hop 172.16.6.6
    Device(config-route-map)# exit
    Device(config)# route-map equal-access permit 20
    Device(config-route-map)# match ip address 2
    Device(config-route-map)# set ip next-hop 192.168.7.7
    Device(config-route-map)# exit
    Device(config)#exit
    
    Device# conf t
    Device(config)# interface GigabitEthernet0/0/2
    Device(config-if)# ip policy route-map equal-access
    Device(config-if)# exit
    

    Additional References

    Related Documents

    Related Topic

    Document Title

    Cisco IOS commands

    Cisco IOS Master Command List, All Releases

    IP routing protocol-independent commands

    Cisco IOS IP Routing: Protocol-Independent Command Reference

    Technical Assistance

    Description

    Link

    The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.

    http:/​/​www.cisco.com/​cisco/​web/​support/​index.html

    Feature Information for Policy-Based Routing

    The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.

    Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/​go/​cfn. An account on Cisco.com is not required.
    Table 1 Feature Information for Policy-Based Routing

    Feature Name

    Releases

    Feature Information

    Policy-Based Routing

    The Policy-Based Routing feature is a process whereby a device puts packets through a route map before routing the packets. The route map determines which packets are routed next to which device. Policy-Based Routing introduces a more flexible mechanism for routing packets than destination routing.

    The following command was introduced or modified: ip policy route-map.