Configure Policy Based routing (PBR) based on source IP
Check: Configure Policy Based routing (PBR) [step by step]
Topology:
We will configure PBR on R1 in order to make the traffic sourced from PC1 (172.16.88.10/24) go through R2 and the traffic sourced from the rest of the networks which include PC2 (172.16.89.10/24) go through R3.
Configuration:
R1:
interface Ethernet0/0
ip address 172.16.88.1 255.255.255.0
ip policy route-map GOTO-R3
half-duplex
!
interface Ethernet0/3
ip address 172.16.89.1 255.255.255.0
ip policy route-map GOTO-R2
half-duplex
!
ip access-list extended Match-UDP
permit udp any any
access-list 110 permit ip 172.16.89.0 0.0.0.255 any
no cdp log mismatch duplex
!
route-map GOTO-R2 permit 10
match ip address 110
set ip next-hop 10.10.1.2
!
route-map GOTO-R3 permit 10
match ip address Match-UDP
set ip next-hop 10.10.2.2
Verification:
- We will perform a traceroute from PC1 and PC2:
- We can see that the route route-map have matched:
Cr: Bilel