1.6 Configure and verify policy-based routing

ENARSI 300-410 v1.1 · 1.0 Layer 3 Technologies

Policy-based routing (PBR) forwards packets by a policy, not only by destination. A route map on the ingress interface matches traffic (an ACL, packet length) and sets the next hop. Packets that match no permit sequence are routed normally. PBR does not change the routing table: show ip route stays the same, and you verify it with show route-map and traceroute.

What you must know

Steering one subnet to a second ISP

ip access-list extended GUEST
 permit ip 10.10.99.0 0.0.0.255 any
!
route-map PBR-GUEST permit 10
 match ip address GUEST
 set ip next-hop verify-availability 198.51.100.1 1 track 20
!
interface GigabitEthernet0/2.99
 ip policy route-map PBR-GUEST
!
ip sla 20
 icmp-echo 198.51.100.1 source-interface GigabitEthernet0/1
 frequency 10
ip sla schedule 20 life forever start-time now
track 20 ip sla 20 reachability

Staff traffic (1) uses the routing table. Guest traffic (2) is policy-routed to ISP B as long as track 20 is up; when it goes down, the set is skipped and guests fall back to the routing table.

Which set clause does what

Set clauseConsulted before the RIB?Use
set ip next-hop AYes: PBR wins if A is directly connected and upForce a path
set ip default next-hop ANo: only if the RIB has no route except the defaultFallback path
set interface Gi0/1Yes (point-to-point links only)Force an exit interface
set ip next-hop recursive AYes, A can be several hops awayNext hop behind the neighbour

Verifying PBR

R1# show route-map PBR-GUEST
route-map PBR-GUEST, permit, sequence 10
  Match clauses:
    ip address (access-lists): GUEST
  Set clauses:
    ip next-hop verify-availability 198.51.100.1 1 track 20  [up]
  Policy routing matches: 412 packets, 31604 bytes

R1# show ip policy
Interface      Route map
Gi0/2.99       PBR-GUEST
  1. show ip policy: is the route map on the ingress interface?
  2. show route-map: are the match counters rising? If not, the ACL does not match (check source and direction).
  3. show track: is the next hop's track up?
  4. traceroute from a guest host: the first hop after R1 shows the path taken.
  5. debug ip policy (with care) prints each policy-routed or rejected packet.

Commands

show ip policyInterfaces with a PBR route map.
show route-map [name]Match clauses, set clauses, track state and packet counters.
show track [n]The object that protects the next hop.
debug ip policyEach packet's PBR decision (use with a condition on busy routers).

Exam traps

Check yourself

Guest traffic still goes to ISP A. The route map is on Gi0/0 toward ISP A. What is wrong?
PBR must be on the ingress interface, the guest subinterface Gi0/2.99.
What happens when the tracked next hop is down?
The set clause is skipped and the packet follows the routing table.
Difference between set ip next-hop and set ip default next-hop?
The first overrides the RIB; the second applies only when the RIB has no specific route.
How do you policy-route the router's own pings?
ip local policy route-map <name> in global configuration.

Labs

Try it live: Policy-based routing: guests to a second ISP, with tracking

More topics in 1.0 Layer 3 Technologies