|
|
This chapter describes the tasks for configuring policy-based routing (PBR) on a router.
For complete conceptual information, see the section "Policy-Based Routing" in the chapter "Classification Overview" in this book.
For a complete description of the PBR commands in this chapter, refer to the Cisco IOS Quality of Service Solutions Command Reference. To locate documentation of other commands that appear in this chapter, use the command reference master index, or search online.
To configure PBR, perform the tasks in the following sections. The first section is required; the remaining sections are optional.
See the end of this chapter for the section "Policy-Based Routing Configuration Examples."
To enable PBR on an interface, use the following commands beginning in global configuration mode:
| Command | Purpose | |
|---|---|---|
Step 1 | route-map map-tag [permit | deny] [sequence-number] | Defines a route map to control where packets are output. This command puts the router into route-map configuration mode. |
Step 2 |
and/or match ip address {access-list-number | name} [...access-list-number | name] | Specifies the match criteria. You can specify one or both of the following:
and/or
If you do not specify a match command, the route map applies to all packets. |
Step 3 |
| Specifies the action or actions to take on the packets that match the criteria. You can specify any or all of the following:
|
Step 4 | interface interface-type interface-number | Specifies the interface. This command puts the router into interface configuration mode. |
Step 5 | ip policy route-map map-tag | Identifies the route map to use for PBR. One interface can only have one route-map tag, but you can have multiple route map entries with different sequence numbers. These entries are evaluated in sequence number order until the first match. If there is no match, packets will be routed as usual. |
The set commands can be used in conjunction with each other. They are evaluated in the order shown in the previous table. A usable next hop implies an interface. Once the local router finds a next hop and a usable interface, it routes the packet.
![]() |
Note Enabling PBR disables fast switching of all packets arriving on this interface. |
If you want PBR to be fast-switched, see the section "Enabling Fast-Switched PBR," which follows.
IP PBR can now be fast-switched. Prior to Cisco IOS Release 12.0, PBR could only be process-switched, which meant that on most platforms the switching rate was approximately 1000 to 10,000 packets per second. This speed was not fast enough for many applications. Users that need PBR to occur at faster speeds can now implement PBR without slowing down the router.
Fast-switched PBR supports all of the match commands and most of the set commands, with the following restrictions:
PBR must be configured before you configure fast-switched PBR. Fast switching of PBR is disabled by default. To enable fast-switched PBR, use the following command in interface configuration mode:
Command | Purpose |
|---|---|
ip route-cache policy |
|
To display the cache entries in the policy route cache, use the show ip cache policy command. To display which route map is associated with which interface, use the show ip policy command.
Command | Purpose |
|---|---|
ip local policy route-map map-tag |
|
All packets originating on the router will then be subject to local PBR.
Use the show ip local policy command to display the route map used for local PBR, if one exists.
The following sections provide PBR configuration examples:
For information on how to configure policy-based routing, see the section "Policy-Based Routing Configuration Task List" in this chapter.
The following example provides two sources with equal access to two different service providers. Packets arriving on asynchronous interface 1 from the source 1.1.1.1 are sent to the router at 6.6.6.6 if the router has no explicit route for the packet's destination. Packets arriving from the source 2.2.2.2 are sent to the router at 7.7.7.7 if the router has no explicit route for the packet's destination. All other packets for which the router has no explicit route to the destination are discarded.
access-list 1 permit ip 1.1.1.1 access-list 2 permit ip 2.2.2.2 ! interface async 1 ip policy route-map equal-access ! route-map equal-access permit 10 match ip address 1 set ip default next-hop 6.6.6.6 route-map equal-access permit 20 match ip address 2 set ip default next-hop 7.7.7.7 route-map equal-access permit 30 set default interface null0
The following example illustrates how to route traffic from different sources to different places (next hops), and how to set the precedence bit in the IP header. Packets arriving from source 1.1.1.1 are sent to the next hop at 3.3.3.3 with the precedence bit set to priority; packets arriving from source 2.2.2.2 are sent to the next hop at 3.3.3.5 with the precedence bit set to critical.
access-list 1 permit ip 1.1.1.1 access-list 2 permit ip 2.2.2.2 ! interface ethernet 1 ip policy route-map Texas ! route-map Texas permit 10 match ip address 1 set ip precedence priority set ip next-hop 3.3.3.3 ! route-map Texas permit 20 match ip address 2 set ip precedence critical set ip next-hop 3.3.3.5
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Posted: Mon Aug 21 21:30:50 PDT 2000
Copyright 1989-2000©Cisco Systems Inc.