Pcornel
Networking · Routing

Policy-Based Routing

Cheat sheet · https://pcornel.dk/topic.php?topic=640

Back to the Topic

Answer

Policy-based routing sends selected traffic a different way than the routing table would: a route-map applied to an ingress interface matches packets (usually by ACL) and sets their next hop or interface.

Remember

It applies only to packets arriving on the interface with ip policy route-map; traffic the router itself sends needs ip local policy route-map. Packets that match no permit are routed normally. If the set next hop is not reachable, packets fall back to normal routing unless configured otherwise.

First checks

  • show ip policy — interfaces with a policy and the route-map used.
  • show route-map <name> — sequences, matches, set clauses and policy-routed packet counts.
  • show access-lists <acl> — hits on the classifying ACL.
  • show ip cef <next hop> — whether the set next hop is reachable.
  • debug ip policy — per-packet decisions; restrict and use briefly.

Commands

show route-map
Shows route-map sequences, match/set clauses and counters.
interface <interface>
Enter interface configuration mode.
ip access-list extended <name>
Create a named extended ACL, here used to match traffic for policy-based routing.
route-map <name> permit <sequence>
Create a route map sequence that permits matching traffic.
match ip address <acl>
Match packets in a route map using an ACL (used for PBR).
set ip next-hop <address>
Send PBR-matched traffic to a specific next hop.
set interface <interface>
Send PBR-matched traffic out a specific interface.
ip policy route-map <name>
Apply a route map for policy-based routing to traffic entering the interface.
show ip policy
Display interfaces with policy-based routing applied.
ip policy route-map
debug ip policy
show ip route <destination>
show route-map <name>
show access-lists <name>
show ip local policy
show ip route

Verify in this order

route-map applied on the ingress interface → ACL matches the flow → route-map sequence permits → next hop set and reachable → packet forwarded via the policy path; non-matching traffic routed normally

Where it usually breaks

wrong ingress or tuple → no policy match → unusable set action → downstream/return filtering or service

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=640

Confirmation

Confirm action

Continue?