INSIGHTS
Networking

How to Configure Policy-Based Routing (PBR) on Cisco Routers

In this article
  1. Where PBR fits beside the routing table
  2. Access lists, route maps and traffic identification
  3. A bounded IOS XE lab configuration
  4. Next-hop verification, WAN backup and failure conditions
  5. PBR versus QoS, security policy and VRFs
  6. Testing, monitoring and rollback
  7. Choosing PBR only when it earns its operational cost

Policy-based routing (PBR) is useful when a router needs to steer selected traffic in a way that differs from the normal destination-based routing result. A branch might send one source subnet toward a designated security inspection path, or redirect a known application subnet to a particular WAN next hop during a controlled migration. PBR is not a faster routing protocol or a traffic-priority queue. It applies policy conditions to eligible packets before they follow the usual forwarding decision, and must be checked against reachability, firewalls, NAT, return-path symmetry, platform limits and operational rollback.

The essential workflow is to identify traffic precisely, match it in an IOS or IOS XE route map, specify a forwarding action, attach the policy to the appropriate ingress interface, and test both matching and nonmatching traffic. An ACL that correctly identifies a flow is not proof that the chosen path is available; a route map that accepts a match is not proof that the application works end-to-end.

Where PBR fits beside the routing table

Ordinary IP routing selects a forwarding path primarily from the destination address and installed route information. Protocols such as OSPF and BGP help populate that routing information. PBR can override the selected next hop or output interface for specifically matched traffic. It does not usually replace those protocols; it depends on underlying connectivity so that a selected next hop is reachable. BGP path attributes determine routes for destinations at routing-policy scope, while PBR can make a different decision for one identified packet class at an ingress interface. The distinction becomes especially important when designing policy-based routing alongside dynamic routing.

PBR is best reserved for a limited number of well-defined exceptions, such as enforcing a path through a specific appliance, shifting a known source range during a staged WAN migration, or steering a service onto a tested connection. It is harder to maintain when dozens of route maps duplicate each other’s match criteria, when destinations change frequently, or when devices lack hardware resources to handle the classification without performance penalties.

It is also important to distinguish packets entering the device from traffic generated by the device itself. An ordinary interface policy controls matching forwarded traffic arriving on that interface. Cisco IOS XE provides a separate local-policy function, ip local policy route-map, for locally generated traffic; its support and limitations should be checked for the platform. Attaching an ingress policy at the wrong interface or assuming a policy automatically covers locally generated pings can produce misleading tests.

Access lists, route maps and traffic identification

On Cisco IOS or IOS XE, PBR commonly matches the source and destination with an extended IPv4 access list, then references that ACL through match ip address inside a route map. The ACL’s permit entries describe eligible traffic for that match. A route-map permit sequence with a valid match can apply its set action; traffic that does not match proceeds to a later sequence or ordinary routing when no policy sequence applies. A route-map deny sequence has different semantics from an interface security ACL: it can prevent a policy action for the matched traffic, leaving it to standard forwarding. Treat permit and deny behavior as part of the explicit test plan rather than assuming they deny network access.

A useful match targets a stable identity and a destination that actually differentiates the flow. Matching permit ip any any is often too broad: it can inadvertently divert management sessions, routing neighbors, voice signaling and unrelated internet traffic. Classifying by TCP or UDP port is possible in an extended ACL when appropriate, but ports are not a universal application identity, especially with TLS, dynamic media streams and tunnels. Confirm that the ACL operates at the expected ingress direction and that the packet is visible before NAT transforms its addresses.

Sequence order matters. Route-map statements may include multiple match or set lines, and platform-specific evaluation rules affect their combination. Use clear numbered sequences, separate exceptional matches from default behavior, inspect counters and document why each condition exists. A catch-all policy should never be introduced simply because it makes a test pass; it can reduce both resilience and the legibility of the forwarding policy.

A bounded IOS XE lab configuration

For a simple IPv4 lab, assume the client network is 192.0.2.0/24, the remote application prefix is 198.51.100.0/24, and 203.0.113.2 represents a directly reachable alternate next hop. All three are documentation ranges and must be replaced with real, reviewed addresses before production. A representative route-map configuration is:

ip access-list extended APP-STEER-MATCH
 permit ip 192.0.2.0 0.0.0.255 198.51.100.0 0.0.0.255
!
route-map APP-STEER permit 10
 match ip address APP-STEER-MATCH
 set ip next-hop 203.0.113.2
!
interface GigabitEthernet0/1
 description Reviewed client ingress
 ip policy route-map APP-STEER

The example changes the next hop for one matched packet class; it neither reserves bandwidth nor applies encryption. It also does not independently verify that 203.0.113.2 is reachable. Before enabling the route map on a live ingress interface, prove that the next-hop adjacency and route exist, that return traffic can find the source, and that firewalls, security zones and NAT are aligned. Back up the original configuration and identify a safe rollback command such as removing the interface policy if the chosen path causes a problem.

Some platforms require a feature license or have resource constraints; Cisco’s documentation explicitly notes IPBase as a minimum requirement in an IOS XE PBR guide. Exact command support, IPv6 equivalents, interface types and hardware acceleration vary by model and software release. Use the applicable device configuration and command reference rather than blindly applying a lab transcript to a switch, router, firewall or SD-WAN platform.

Next-hop verification, WAN backup and failure conditions

One of the most consequential errors is assuming that every set ip next-hop action automatically checks the health of the chosen path. Cisco’s IOS routing command reference states that PBR next-hop reachability verification is disabled by default. Where the platform supports it, set ip next-hop verify-availability can integrate with configured reachability or tracking information, and more advanced configurations can identify a sequence of next hops. That is not the same as assuring an application is healthy: a reachable router can still sit in front of a broken firewall, DNS resolver, service or asymmetric return path.

For backup WAN design, document what a policy does when its next hop becomes unusable. Test the actual selected behavior, including whether the router reverts to the normal destination route or follows a different configured policy next hop; do not assume failover based only on a configured tracking object. If redundant paths use stateful firewalls, NAT or VPN tunnels, consider how an asymmetric change will affect session continuity. A failover that moves the outbound path while the return path remains tied to another firewall may be worse than the original interruption.

PBR does not create load balancing merely because two internet circuits exist. If two policy classes deliberately use different next hops, that is steering, not capacity-aware distribution or guaranteed equal load. A system combining IP SLA tracking, routing, application-aware SD-WAN or traffic engineering may accomplish more, but each component has its own failure cases and verification requirements.

PBR versus QoS, security policy and VRFs

PBR determines which next hop or interface selected traffic follows. Quality of Service (QoS) defines separate marking, queueing, policing or shaping behaviors on traffic under congestion. Sending voice packets to a designated WAN link does not automatically give them priority when that link is saturated. A proper voice design may need codec bandwidth estimation, DSCP trust boundaries, queueing and end-to-end latency or jitter measurements. PBR can steer a flow through a path, but cannot guarantee low latency, zero packet loss or an application service-level objective.

Likewise, matching a traffic class in a route map is not equivalent to enforcing a firewall security policy. It can help direct packets through a reviewed security device, but does not by itself authenticate a user, encrypt a session, prevent data exfiltration or isolate tenant routing tables. VRFs provide distinct forwarding domains; ACLs and firewall rules enforce traffic permits; IPsec or TLS provide cryptographic protections when correctly configured. Combining these features requires attention to address translation, interface zones and return-path state.

A route map should be part of an explicit traffic flow design: identify who initiates the session, what prefix and protocol they use, where the next hop is, which device terminates or inspects the connection, and which path carries the response. Document the expected normal-routing outcome as a comparison. If an application requires stable path symmetry, a clever PBR exception may be a poor substitute for routing or topology repair.

Testing, monitoring and rollback

After attaching the policy, inspect show ip policy and show route-map to verify that the intended interface and matches are active. Depending on platform, check access-list counters, CEF forwarding information, IP SLA tracking state, adjacency status and live interface output. Generate traffic from the actual client subnet and test both a matching and a nonmatching flow; a ping originating on the router may bypass an interface-ingress policy and therefore prove the wrong thing.

Use packet capture or flow records where authorized to verify the actual egress and return path, then repeat the test with the alternate next hop down. Review routes and device logs while testing so a transient successful traceroute is not mistaken for an application-level pass. A route-map hit count demonstrates a classifier matched; it does not prove a TCP session completed, a voice stream remained intelligible or encrypted traffic passed the intended policy inspection point.

When the policy causes an outage, revert the interface attachment or restore the previous route map from a saved known-good configuration, then clear or re-establish sessions when needed. Keep a rollback procedure that does not depend on reaching the device through the very path being modified. After any repair, verify business-critical applications and next-hop tracking in addition to the route map counters.

Choosing PBR only when it earns its operational cost

Policy-based routing is most valuable when the organization can state a concrete traffic-selection rule and a reason why normal destination routing is insufficient. In some cases an ordinary static or dynamic route, VRF design, firewall policy, SD-WAN overlay, or QoS change is easier to maintain and provides better diagnostics. Compare those alternatives against the same requirements for failure handling, security, performance evidence, change volume and device support.

A sound PBR release requires more than a syntactically accepted route map. The engineer should be able to identify matching traffic, the chosen next hop, the expected default path for nonmatches, any fallback method, symmetric stateful return path, monitoring evidence and a tested rollback. PBR gives control over an exception in forwarding behavior; it does not convert routing into automatic security, prioritization or uninterrupted connectivity.

Filed under Networking