Lesson Overview
Policy-Based Routing (PBR) is an advanced routing technique that allows network administrators to control how packets are forwarded based on predefined policies rather than relying exclusively on the destination IP address and the routing table.
Traditional routing selects a forwarding path primarily using the destination IP address and the longest-prefix-match rule. PBR extends this capability by allowing traffic to be classified using attributes such as source IP address, destination IP address, protocol, and TCP/UDP port numbers.
PBR is commonly deployed in enterprise networks where different applications, users, departments, or traffic categories require different forwarding paths.
For example, an organization with two Internet Service Providers (ISPs) may want:
Finance department traffic to use ISP-1.
Guest network traffic to use ISP-2.
Critical application traffic to follow a dedicated WAN connection.
Other traffic to follow the normal routing table.
PBR enables these requirements without changing the destination-based routing decisions for every packet in the network.
This lesson covers advanced PBR concepts, packet-processing behavior, route-map configuration, next-hop selection, recursive forwarding, IP SLA tracking, local PBR, VRF-aware PBR, troubleshooting, and enterprise deployment scenarios.
Learning Objectives
After completing this lesson, you will be able to:
Explain Policy-Based Routing and its purpose.
Differentiate PBR from traditional destination-based routing.
Understand how ACLs and route maps work together in PBR.
Configure source-based and application-based routing policies.
Explain
set ip next-hop,set interface, andset ip default next-hop.Understand recursive next-hop forwarding and policy fallback.
Configure PBR with IP SLA and object tracking.
Implement local PBR for router-generated traffic.
Understand VRF-aware PBR and multi-VRF forwarding.
Explain PBR interaction with CEF, NAT, routing protocols, and QoS.
Verify PBR forwarding decisions.
Troubleshoot routing black holes, asymmetric routing, and failed next hops.
Apply PBR in dual-ISP enterprise networks.
1. What Is Policy-Based Routing?
Policy-Based Routing is a mechanism that modifies the normal forwarding decision for selected packets according to an administrator-defined policy.
The policy is usually implemented through a route map that matches traffic and specifies an alternative forwarding action.
Traditional Routing
A router normally evaluates the destination IP address and searches its forwarding information for the best matching route.
Policy-Based Routing
With PBR, the router evaluates a configured policy for eligible packets before applying normal forwarding.
Key concept: PBR influences forwarding for matching traffic. It does not replace the routing table or automatically modify routes learned through OSPF, EIGRP, or BGP.
2. Traditional Routing vs Policy-Based Routing
Feature | Traditional Routing | Policy-Based Routing |
|---|---|---|
Main Decision Factor | Destination IP | Configured traffic attributes |
Forwarding Source | Routing/FIB lookup | Route-map policy and forwarding resolution |
Source-Based Decisions | Not normally | Yes |
Application-Based Decisions | Not normally | Yes, using supported packet matching |
Routing Protocol Dependency | Uses installed routes | Can override normal route selection |
Configuration | Static/dynamic routing | ACLs, route maps, interface policies |
Complexity | Generally lower | Higher |
Typical Use | General packet forwarding | Traffic steering and special routing requirements |
R1 is the PBR router for the branch LAN. ISP-1 is the preferred path for selected Internet traffic, while ISP-2 is the secondary path. The route map is applied inbound on R1's LAN-facing interface so policy decisions occur as branch packets enter R1.
Figure 3. PBR WAN path-steering topology using Cisco-style router, switch, endpoint, and WAN icons.
|
Device |
Interface |
Address |
Role |
|
PC-A |
NIC |
192.168.10.10/24 |
Branch user; gateway 192.168.10.1 |
|
R1 |
Gi0/0 |
192.168.10.1/24 |
LAN-facing PBR input interface |
|
R1 |
Gi0/1 |
10.1.1.1/30 |
Primary ISP-1 link |
|
ISP-1 |
Gi0/0 |
10.1.1.2/30 |
Preferred WAN next hop |
|
R1 |
Gi0/2 |
10.2.2.1/30 |
Secondary ISP-2 link |
|
ISP-2 |
Gi0/0 |
10.2.2.2/30 |
Backup/alternate WAN next hop |
|
Server |
NIC |
203.0.113.10/24 |
Remote test destination |
Why Use PBR?
The router may have only one preferred default route in its routing table.
PBR allows selected traffic to use a different next hop without requiring a separate routing table for every department.
Important: Internet-bound traffic also needs appropriate NAT, firewall, and return-path configuration. PBR alone does not provide Internet connectivity.
4. PBR Components
4.1 Access Control Lists (ACLs)
ACLs classify the traffic that should match a PBR policy.
A standard ACL can match source IPv4 addresses.
An extended ACL can match source addresses, destination addresses, protocols, and ports.
Standard ACL Example
|
ip access-list standard FINANCE permit 192.168.10.0 0.0.0.255 |
|
ip access-list extended WEB-TRAFFIC permit tcp 192.168.10.0 0.0.0.255 any eq 443 |
This matches TCP packets sourced from the Finance subnet and destined for TCP port 443.
Important ACL Behavior in PBR
Within a route-map match ip address statement:
An ACL
permitentry identifies traffic that matches the route-map condition.An ACL
denyentry excludes traffic from that match.ACL
denydoes not mean the packet is dropped by PBR.
Packets that do not match a PBR route-map entry may be evaluated against later route-map entries or forwarded using normal routing.
4.2 Route Maps
Route maps define traffic classification and the forwarding action.
Syntax
|
route-map ROUTE_MAP_NAME permit 10 match ip address ACL_NAME set ip next-hop NEXT_HOP_IP |
Route-Map Components
Component | Function |
|---|---|
| Creates a policy |
| Allows a matching sequence to apply its action |
| Excludes matching traffic from policy routing |
Sequence Number | Controls evaluation order |
| Matches packets classified by an ACL |
| Specifies a policy next hop |
Route-Map Processing
Route-map sequences are evaluated in ascending sequence-number order.
When a packet matches a permit sequence, the configured forwarding action is considered.
A packet matching a deny sequence is not policy-routed by that route map and normally follows destination-based routing.
5. Route-Map Matching
A PBR route map contains ordered sequences. A match clause identifies packets, and a set clause defines the desired forwarding action. The route map is processed from the lowest sequence number upward.
|
Element |
Purpose |
Example |
|
ACL |
Classify source/destination/protocol traffic |
"match ip address PBR-INET" |
|
Sequence |
Control evaluation order |
"route-map PBR-WAN permit 10" |
|
permit |
Allow the sequence to apply PBR set actions |
"permit 10" |
|
deny |
Packets matching that sequence are not policy-routed by that sequence |
"deny 20" |
|
set action |
Select next hop or interface |
"set ip next-hop 10.1.1.2" |
ACL Example
|
ip access-list extended PBR-INET permit ip host 192.168.10.10 host 203.0.113.10 |
This ACL identifies traffic from PC-A to the remote training server.
Route-Map Example
|
route-map PBR-WAN permit 10 match ip address PBR-INET set ip next-hop 10.1.1.2 |
|
Route-map logic: The ACL is used only as classification for the route map. The route-map permit/deny logic controls whether the PBR set action is applied; it is not simply an interface packet-filtering ACL. |
6. Use of "set ip next-hop"
"set ip next-hop" directs matching traffic toward a specified next-hop IPv4 address. The next hop should be reachable from the PBR router and resolvable for forwarding.
|
route-map PBR-WAN permit 10 match ip address PBR-INET set ip next-hop 10.1.1.2 |
The set action affects only traffic matched by the route-map sequence.
The next-hop address is usually on a directly connected or otherwise resolvable network.
CEF and adjacency information still determine the actual forwarding encapsulation.
Use "show ip cef <destination>" and next-hop reachability checks when troubleshooting.
7. Use of "set interface"
"set interface" can direct matching packets toward a specified outgoing interface. This is most predictable on point-to-point links. On multiaccess Ethernet networks, a next-hop address is generally clearer because the device must still determine the Layer 2 destination.
|
route-map PBR-VOICE permit 10 match ip address PBR-VOICE-ACL set interface GigabitEthernet0/1 |
|
Operational caution: Prefer a next-hop address for Ethernet/multiaccess designs unless the platform/design specifically requires an interface-only action. Verify the exact behavior on the target IOS/IOS XE release. |
8. Multiple Next Hops
A route-map set clause can list multiple next-hop addresses. Cisco IOS/IOS XE evaluates them in the configured order and uses an available/reachable next hop according to platform PBR forwarding behavior.
|
route-map PBR-WAN permit 10 match ip address PBR-INET set ip next-hop 10.1.1.2 10.2.2.2 |
10.1.1.2 is the preferred next hop.
10.2.2.2 provides an alternate choice.
This is not the same as dynamic SLA-based path quality monitoring.
For deterministic failover based on reachability, use a supported "verify-availability" design with IP SLA/object tracking when available on the platform.
9. Complete Basic PBR Configuration
R1 training configuration
|
! R1 interfaces interface GigabitEthernet0/0 description BRANCH-LAN ip address 192.168.10.1 255.255.255.0 ip policy route-map PBR-WAN no shutdown ! interface GigabitEthernet0/1 description PRIMARY-ISP1 ip address 10.1.1.1 255.255.255.252 no shutdown ! interface GigabitEthernet0/2 description SECONDARY-ISP2 ip address 10.2.2.1 255.255.255.252 no shutdown ! ! Normal routing baseline ip route 0.0.0.0 0.0.0.0 10.2.2.2 ! ! Match selected traffic ip access-list extended PBR-INET permit ip host 192.168.10.10 host 203.0.113.10 ! ! Policy steer selected traffic to ISP-1 route-map PBR-WAN permit 10 match ip address PBR-INET set ip next-hop 10.1.1.2 |
In this example, selected PC-A-to-server traffic is policy-routed through ISP-1. Traffic that does not match PBR follows the normal default route through ISP-2.
10. PBR Use Cases
|
Use Case |
Policy Example |
|
WAN path steering |
Send business-critical traffic through MPLS/ISP-1 and general Internet traffic through ISP-2. |
|
Service insertion |
Steer selected traffic toward a firewall, IDS/IPS, proxy, or service appliance. |
|
Application separation |
Send voice/video or SaaS traffic through a lower-latency path. |
|
Source-based routing |
Different user VLANs or departments use different WAN exits. |
|
Migration / exceptions |
Temporarily bypass the normal route for a controlled subset of traffic. |
|
Management path |
Force selected management traffic through a dedicated management WAN. |
11. Verification
|
Command |
What It Shows |
|
show route-map |
Match counters, match clauses, and set actions. |
|
show ip policy |
Which interfaces have a PBR route map applied. |
|
show access-lists |
Whether classification ACL counters are increasing. |
|
show ip route <destination> |
Normal routing-table path for comparison. |
|
show ip cef <destination> detail |
CEF next hop/interface and policy-routing forwarding detail where displayed. |
|
show interfaces |
Interface state and counters. |
|
traceroute <destination> |
Observed forwarding path from a test source. |
Representative Output
|
R1# show ip policy Interface Route map Gi0/0 PBR-WAN
R1# show route-map PBR-WAN route-map PBR-WAN, permit, sequence 10 Match clauses: ip address (access-lists): PBR-INET Set clauses: ip next-hop 10.1.1.2 Policy routing matches: 125 packets, 14850 bytes |
|
R1# show access-lists PBR-INET Extended IP access list PBR-INET 10 permit ip host 192.168.10.10 host 203.0.113.10 (125 matches) |
The increasing counters prove that the traffic is matching the ACL and route-map sequence.
Compare Normal Routing with PBR
|
R1# show ip route 203.0.113.10 Routing entry for 0.0.0.0/0 Known via "static" * 10.2.2.2
! Normal routing would use ISP-2.
R1# show route-map PBR-WAN Set clauses: ip next-hop 10.1.1.2
! Matching PBR traffic is steered to ISP-1. |
Policy-Based Routing (PBR) can be applied to two different types of traffic: transit traffic and locally generated traffic. Cisco routers support Transit PBR and Local PBR to control forwarding decisions based on predefined routing policies.
The primary difference is where the traffic originates and how the PBR policy is applied.
13.1 Transit Policy-Based Routing (Transit PBR)
Transit PBR is used to control the forwarding path of packets that originate from external devices and pass through a router.
The policy is applied inbound on the Layer 3 interface where the traffic enters the router.
Key Characteristics
Transit Traffic: Applies to packets received from external devices, such as PCs, servers, or other routers.
Interface-Based Configuration: Configured using
ip policy route-mapon the incoming interface.Traffic Classification: Uses ACLs and route maps to match source addresses, destination addresses, protocols, or ports.
Custom Forwarding: Directs matching traffic toward a specified next hop or outgoing interface.
Normal Routing Fallback: Nonmatching traffic follows the normal routing table.
Common Use Cases: Dual-ISP traffic steering, application-based routing, and department-specific WAN paths.
Configuration on R1
Step 1: Configure the destination-matching ACL
|
configure terminal
ip access-list extended TRANSIT-ISP1 permit ip 192.168.10.0 0.0.0.255 host 8.8.8.8 |
|
route-map TRANSIT-PBR permit 10 match ip address TRANSIT-ISP1 set ip next-hop 10.1.1.2
route-map TRANSIT-PBR permit 20 set ip next-hop 10.2.2.2 |
Sequence 10 directs PC-A's traffic destined for 8.8.8.8 through ISP-1. Sequence 20 matches all remaining traffic received on the PBR-enabled interface and directs it through ISP-2.
Step 3: Apply Transit PBR inbound
|
interface GigabitEthernet0/0 description BRANCH_LAN ip policy route-map TRANSIT-PBR
end |
|
R1# show ip policy
Interface Route map Gi0/0 TRANSIT-PBR |
|
R1# show route-map TRANSIT-PBR
route-map TRANSIT-PBR, permit, sequence 10 Match clauses: ip address (access-lists): PBR-INTERNET Set clauses: ip next-hop 10.1.1.2
route-map TRANSIT-PBR, permit, sequence 20 Match clauses: ip address (access-lists): PBR-OTHER Set clauses: ip next-hop 10.2.2.2 |
13.2 Local Policy-Based Routing
Local PBR controls packets generated directly by R1.
Examples include router-originated ping, traceroute, and certain monitoring or management traffic.
Unlike Transit PBR, Local PBR is configured globally and does not require an ingress interface.
Local Traffic Flow
Step 1: Configure ACLs
For repeatable testing, we will use the source IP address of R1's ISP-1-facing interface.
|
ip access-list extended LOCAL-INTERNET permit icmp host 10.1.1.1 host 8.8.8.8
ip access-list extended LOCAL-REMOTE permit icmp host 10.1.1.1 host 203.0.113.10 |
These ACLs match router-generated ICMP echo packets using source 10.1.1.1.
Step 2: Configure Local PBR Route Map
|
route-map LOCAL-PBR permit 10 match ip address LOCAL-INTERNET set ip next-hop 10.1.1.2
route-map LOCAL-PBR permit 20 match ip address LOCAL-REMOTE set ip next-hop 10.2.2.2 |
|
ip local policy route-map LOCAL-PBR
end |
Verify Local PBR
Command 1: Verify Local Policy
|
R1# show ip local policy
Local policy routing is enabled, using route map LOCAL-PBR |
|
R1# show route-map LOCAL-PBR
route-map LOCAL-PBR, permit, sequence 10 Match clauses: ip address (access-lists): LOCAL-INTERNET Set clauses: ip next-hop 10.1.1.2
route-map LOCAL-PBR, permit, sequence 20 Match clauses: ip address (access-lists): LOCAL-REMOTE Set clauses: ip next-hop 10.2.2.2 |
|
R1# show running-config | include ip local policy
ip local policy route-map LOCAL-PBR |
14. Failure Behavior
Failure behavior depends on the PBR set action, next-hop resolution, platform, and configuration. A simple PBR policy is not a substitute for active path monitoring.
|
Scenario |
Expected Conceptual Behavior |
|
Packet does not match route map |
Normal destination-based routing is used. |
|
Route-map sequence matches but no usable set action is available |
Device may fall back to normal routing according to supported PBR behavior. |
|
First of multiple next hops unavailable |
A later configured next hop can be considered if usable. |
|
Primary WAN path has upstream failure but local next hop remains reachable |
Basic PBR may continue selecting that local next hop; remote outage may not be detected. |
|
Need deterministic end-to-end failover |
Use IP SLA/object tracking and a platform-supported `set ip next-hop verify-availability` design. |
|
Important: A locally reachable next hop does not prove the entire WAN path is healthy. For production WAN steering, track an appropriate remote target and validate platform-specific PBR tracking syntax. |
15. PBR with Reachability Tracking - Concept
Where supported, Cisco IOS/IOS XE can combine PBR with IP SLA/object tracking so a next hop is used only when a tracked reachability condition is up.
Conceptual failover example
|
ip sla 10 icmp-echo 8.8.8.8 source-interface GigabitEthernet0/1 frequency 5 ip sla schedule 10 life forever start-time now ! track 10 ip sla 10 reachability ! route-map PBR-WAN permit 10 match ip address PBR-INET set ip next-hop verify-availability 10.1.1.2 10 track 10 set ip next-hop 10.2.2.2 |
|
Platform note: Exact `verify-availability` syntax and supported tracking options vary by software release. Confirm the command reference for the target platform before production use. |
16. Troubleshooting PBR
|
Symptom |
Likely Cause |
Verification / Fix |
|
No traffic matches PBR |
ACL does not match real source/destination |
Check `show access-lists` counters and packet addresses. |
|
Route map has zero matches |
Policy applied on wrong interface or direction |
Use `show ip policy`; apply PBR inbound where traffic enters R1. |
|
Wrong WAN path selected |
Incorrect set next hop or sequence order |
Inspect `show route-map` and route-map sequence logic. |
|
Next hop configured but traffic fails |
Next hop unreachable / missing adjacency / upstream outage |
Ping next hop, inspect ARP/CEF, verify WAN reachability. |
|
Some traffic unexpectedly uses normal route |
Traffic does not match any permit sequence or set action is unusable |
Check ACLs, route-map permit/deny sequences, and reachability. |
|
Failover does not occur when Internet beyond ISP fails |
Local next hop remains reachable |
Use IP SLA/object tracking or a routing protocol that detects path failure. |
|
PBR affects router-generated traffic differently |
Interface PBR applies to transit packets entering interface |
Use platform-supported local PBR (`ip local policy route-map`) if router-originated traffic must be policy-routed. |
16.1 Troubleshooting Sequence
1. Confirm the test packet source and destination.
2. Confirm the packet enters the interface where `ip policy route-map` is applied.
3. Check classification ACL counters.
4. Check route-map match counters and sequence order.
5. Verify the configured next hop/interface is reachable and usable.
6. Compare the normal routing-table path with the intended PBR path.
7. Use CEF, traceroute, and interface counters to confirm actual forwarding.
8. Test failure behavior in a lab before relying on PBR for production WAN resiliency.
Quick knowledge check
1. What is the main difference between normal routing and PBR?
Answer: Normal routing selects a path mainly from the destination routing table; PBR can override forwarding for selected traffic using a route map.
2. On which interface is transit PBR normally applied?
Answer: Inbound on the interface where the traffic enters the PBR router.
3. What happens to packets that do not match PBR?
Answer: They follow normal destination-based routing.
4. What can provide deterministic PBR failover?
Answer: A supported IP SLA/object-tracking and "set ip next-hop verify-availability" design.
