PBR
Policy Based Routing
This is called Source-based routing, whenever we talk about Routing Table that does a destination-based routing, all the protocols RIP, EIGRP, OSPF, or BGP also whenever these protocols learn the route they put the route in the Routing table and put the destination information, so whenever a router get traffic it checks the destination address in Routing Table and route the packet
But using Policy-Based Routing PBR we can make a router aware of the source and tell how to process the packet for a particular source without checking the destination in the routing table.
For a better understanding of PBR, you should be clear with ACL and Route-map, to match a source we use ACL and to ACL we call under route-map and finally we apply route-map for PBR
PBR we can use in two ways:
Interface based PBR: Work when the router gets the packet on the interface
Local PBR: works when the router originates the packet for any destination with a specified source
Interface Based PBR: so in our case we will send traffic from Router R1 to destination R4, first we will see the default behavior and then we will apply interface based PBR on R2, we always apply PBR on the ingress interface and call a next-hop address of egress interface in route-map
As we can see using source 1.1.1.1 and 11.11.11.11 the traffic is going from R1àR2àR4
Now we will apply PBR for source 1.1.1.1 on Router R2 and will try to route traffic from R1 to R4 via R3
R1àR2àR3àR4
1. Match source in ACL
2. Create route-map and call ACL
3. Bind route-map with Interface Policy
Ø R2(config)#access-list 1 permit 1.1.1.1 0.0.0.0
Ø R2(config)#
Ø R2(config)#route-map InterfacePBR permit 10
Ø R2(config-route-map)#match ip address 1
Ø R2(config-route-map)#set ip next-hop 23.0.0.03
Ø R2(config-route-map)#exit
Ø R2(config)#
Ø R2(config)#interface fastethernet 0/0
Ø R2(config-if)#ip policy route-map InterfacePBR
Ø R2(config-if)#exit
And now we have done the configuration, and the traffic should go via R3 (R1àR2àR3àR4)
We can also match destination prefix in ACL to match specific traffic.
Local PBR: in this Local PBR, we match the traffic originated from the router itself.
So in our case, we have created 2 loopback address on Router R2, let’s do a trace to 4.4.4.4 using both source address.
Now we will apply Local PBR to route traffic with source 2.2.2.2 via R3 to R4.
1. Match source in ACL
2. Create route-map and call ACL
3. Bind route-map with Interface Policy
Ø R2(config)#access-list 2 permit host 2.2.2.2
Ø R2(config)#
Ø R2(config)#route-map PBR permit 10
Ø R2(config-route-map)#match ip address 2
Ø R2(config-route-map)#set ip next-hop 23.0.0.03
Ø R2(config-route-map)#exit
Ø R2(config)#
Ø R2(config)#ip local policy route-map PBR
Now the traffic should go via Router R3 for source 2.2.2.2
And when we use a different source 22.22.22.22 it goes via the same path that is present in Routing Table
Learn With CNC | Core Networking Classes