Policy-Based Routing

Share it!

Policy-based Routing (PBR) is a method that a router ignores the “normal” process of forwarding packets based on the routing table and forwards it based on the configured policy. The incoming packet is captured by the policy before the router performs the CEF table check.

In order to forward the packet, the policy match a route-map with instructions how to forward the packet. An ACL is used in the route-map in order to match the interesting traffic and “set” commands are used in order to instruct the router how to route the packet. The forwarding decision can be made by forwarding the packet to an interface or next hop.

“set” commands:
#set ip next-hop
#set ip default next-hop
#set interface
#set default interface
The difference in the commands with the “default” keyword is that the router first forward the packet based on the routing table – but not default routes – and then uses the policy forwarding.

Commands in order to configure PBR:
e.g.

  1. First create an ACL to match interesting traffic

#access-list 101 permit tcp 10.10.10.0 255.255.255.0 192.168.10.0 255.255.255.0

  1. Create the route-map

#route-map example-PBR permit

#match ip address 101

#set interface fa0/1

  1. Add a policy in an interface

#interface fa0/0

#ip policy route-map example-PBR

In this example we match the, incoming to fa0/0 interface, network 10.10.10.0/24 with destination 192.168.10.0/24 to be forwarded out of the fa0/1 interface.

Verification:
#show ip policy
#show route-map
#debug ip policy


Share it!

notis

I am a network engineer since 2014. My main goal and the purpose of this site is to document whatever I learn so I can explain them better and of course transfer the knowledge in really simple words. Please feel free to contact me or visit my profiles for more information.