IP Routing: Protocol-Independent Configuration Guide, Cisco IOS Release 15M&T
Policy-Based Routing
Downloads: This chapterpdf (PDF - 1.24MB) The complete bookPDF (PDF - 4.24MB) | The complete bookePub (ePub - 806.0KB) | Feedback

Policy-Based Routing

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 to which device next. 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 at the end of this module.

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 to which device next. You might enable policy-based routing if you want certain packets to be routed some 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 | deny] [sequence-number] global configuration command.

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

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


Note


Mediatrace will show statistics of incorrect interfaces with policy-based routing (PBR) if the PBR does not interact with CEF or Resource Reservation Protocol (RSVP). Hence configure PBR to interact with CEF or RSVP directly so that mediatrace collects statistics only on tunnel interfaces and not physical interfaces.


How to Configure Policy-Based Routing

Configuring Policy-Based Routing

SUMMARY STEPS

    1.    enable

    2.    configure terminal

    3.    interface type number

    4.    ip policy route-map map-tag

    5.    exit

    6.    route-map map-tag [permit | deny] [sequence-number]

    7.    Enter one or both of the following commands:

    • match length
    • match ip address

    8.    set ip next-hop {ip-address[...ip-address] | dynamic dhcp | encapsulate l3vpn profile-name | peer-address | recursive [global | vrf vrf-name] ip-address | verify-availability [ip-address sequence track track-object-number]}

    9.    end


DETAILED STEPS
     Command or ActionPurpose
    Step 1 enable


    Example:
    Device> enable
    
     

    Enables privileged EXEC mode.

    • Enter your password if prompted.
     
    Step 2 configure terminal


    Example:
    Device# configure terminal
     

    Enters global configuration mode.

     
    Step 3 interface type number


    Example:
    Device(config)# interface gigabitethernet 1/0/0
     

    Configures an interface type and enters interface configuration mode.

     
    Step 4 ip policy route-map map-tag


    Example:
    Device(config-if)# ip policy route-map equal-access
     

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

     
    Step 5 exit


    Example:
    Device(config-if)# exit
     

    Returns to global configuration mode.

     
    Step 6 route-map map-tag [permit | deny] [sequence-number]


    Example:
    Device(config)# route-map equal-access permit 10
     

    Defines the conditions for redistributing routes from one routing protocol into another routing protocol or enables policy-based routing and enters route-map configuration mode.

    • map-tag—A meaningful name for the route map.
    • permit—(Optional) If the match criteria are met for this route map, and the permit keyword is specified, the route is redistributed as controlled by the set actions. In the case of policy routing, the packet is policy routed. If the match criteria are not met, and the permit keyword is specified, the next route map with the same map tag is tested. If a route passes none of the match criteria for the set of route maps sharing the same name, it is not redistributed by that set.
    • deny—(Optional) If the match criteria are met for the route map and the deny keyword is specified, the route is not redistributed. In the case of policy routing, the packet is not policy routed, and no further route maps sharing the same map tag name will be examined. If the packet is not policy routed, the normal forwarding algorithm is used.
    • sequence-number—(Optional) Number that indicates the position a new route map will have in the list of route maps already configured with the same name. If used with the no form of this command, the position of the route map configure terminal should be deleted.
     
    Step 7Enter one or both of the following commands:
    • match length
    • match ip address


    Example:
    Device(config-route-map)# match ip address 1
     

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

     
    Step 8set ip next-hop {ip-address[...ip-address] | dynamic dhcp | encapsulate l3vpn profile-name | peer-address | recursive [global | vrf vrf-name] ip-address | verify-availability [ip-address sequence track track-object-number]}


    Example:
    Device(config-route-map)# set ip next-hop 172.16.6.6
     

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

     
    Step 9end


    Example:
    Device(config-route-map)# end
     

    Exits route-map configuration mode and returns to privileged EXEC mode.

     

    Configuration Examples for Policy-Based Routing

    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 to which device next. 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.