Pcornel
Networking · Routing › Policy-Based Routing

Set next-hop

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

Back to the Topic

Answer

set ip next-hop <address> sends matched packets to that next hop instead of using the routing table. The address should be on a directly connected network.

Remember

If the next hop is not reachable, the packet falls back to normal routing — which can hide a failure. Use set ip next-hop verify-availability <address> <seq> track <n> to tie it to a track object. set ip default next-hop is different: it applies only when the routing table has no explicit route.

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

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.

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

underlay/interface reachability → protocol adjacency/session → received/originated state → policy → best path/RIB → FIB/adjacency → traffic path

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

Confirmation

Confirm action

Continue?