Page 1 of 1

static route from source IP to destination

Posted: 21 Apr 2024 16:09
by papcm
Hello,

Can someone help to configure a static route from a specific source ip address to a destination (next hop)?

Example:
I have a static route to destination 192.168.1.0/24 to next hop 10.20.1.4:

ip static-route 192.168.100.0/24 gateway 10.20.1.4 metric 1
ip access-list "static_routes" address 192.168.1.0/24 action permit redist-control all-subnets
ip route-map "static2ospf" sequence-number 10 action permit
ip route-map "static2ospf" sequence-number 10 match ip-address "static_routes"
ip redist static into ospf route-map "static2ospf" admin-state enable

And now I need to route just one ip source address from subnet 192.168.1.0/24 to a different next hop.
I need to route packets from 10.30.1.10 to subnet 192.168.100.0/24 to the next hop 10.20.1.5.

Thank you.

Re: static route from source IP to destination

Posted: 24 Apr 2024 01:13
by Gleylancer
10.30.1.10 is not in the subnet 192.168.1.0/24, so that doesn't work.

If the switch is the gateway for 10.30.1.10, all you need to do is point 10.30.1.10 to 10.20.1.5. I would question that design decision though.

Re: static route from source IP to destination

Posted: 25 Apr 2024 14:47
by silvio
This is possible (named PBR - policy based routing). Search in the guides (or here in the forum) for "policy action permanent-gateway".
BR Silvio