0

I have to modify all routes using one specific dev. Not even modify, just append a correct src то the end of a route, like this:

x.x.x.x(destination network) via y.y.y.y(MYDEV ip) dev MYDEV(network device) proto zebra

To this:

x.x.x.x(destination network) via y.y.y.y(MYDEV ip) dev MYDEV(network device) proto zebra src z.z.z.z(correct src ip, needed for correct transit routing throw y.y.y.0/23 network)

Of course, i can do it by simple bash script and crond it, but my question is:

Can i append correct src to all the routes, that uses MYDEV by using ip rule and routing tables?

PS: I cannot modify this routes directly by zebra because of complicated network configuration(cannot match specific route-map).

2
  • Do you mean like stateless nat? linux-ip.net/html/nat-stateless.html . You could copy all appropriate rules to a separate routing table which had the other source ip specified and then specify a rule to route anything going out by that interface to use the correct table. However, you can't use ip rule to match on oif (outgoing interface) if you are routing non-local packets, so you would have to match on destination and create appropriate rules dynamically. Which sounds like a massive pain and why this response is not answer-worthy. Mar 6, 2015 at 14:03
  • Zebra sends all the route dynamically to kernel routing tables, so neither i can add them to separate table. Mar 6, 2015 at 14:33

0

You must log in to answer this question.

Browse other questions tagged .