Policy-Based Routing (PBR)
Policy-Based Routing (PBR) is a network routing technique that allows us to make routing decisions based on specific policies or criteria other than traditional routing factors like destination IP addresses.
With PBR, we can route network traffic based on factors such as source IP addresses, source ports, protocols, or other attributes, enabling more granular control over how data flows through our network.
Topology
Here’s the network topology
currently the traffic flow from 172.16.0.4 (XE4) going to 8.8.8.8 will go through XE2
We will apply PBR on XE1 to make traffic from segment 172.16.0.0 goes thorugh XE3
PBR Configuration
First let’s create an access-list for the 172.16.0.0 segment
1
access-list 1 permit 172.16.0.0 0.0.0.255 log
Next we create the route-map and match it with the access-list
1
2
3
route-map PBR permit 10
match ip address 1
set ip next-hop 99.0.0.3
Finally, apply the route-map on the ingress interface
1
2
3
interface GigabitEthernet4
ip address 172.16.0.1 255.255.255.0
ip policy route-map PBR
And that’s pretty much it.
PBR Validation
Now if we try pinging from XE4, we should see the traffic going through XE3 instead
Running show “route-map” shows the detail of PBR route-map configuration
To see the applied PBR, run “show ip policy”
To see the matched access-list, run “show access-lists 1”