I'm trying to persist (between reboots) routes and rules from iproute2 in Alpine Linux, so far without success.
Here are the commands:
ip route add default via 192.168.200.1 dev eth1 table net2 ip rule add from 192.168.200.10/24 table net2 ip rule add to 192.168.200.1/32 table net2
So the proper way to do this should be theoretically by using the "post-up" callback in the "/etc/network/interfaces" file in the eth1 interface. So I added these lines to the interface:
post-up route add default via 192.168.200.1 dev eth1 table net2 post-up ip rule add from 192.168.200.10/24 table net2 post-up ip rule add to 192.168.200.1/32 table net2
But it doesn't works. It seems like the callback is never run. The same goes with "up". I tried a simple "touch /tmp/ok" and the file gets never created.
Alternatively I tried creating a script inside the "/etc/network/if-post-up.d" but the script gets called for every interface that goes up, resulting in repeated entries in the rules. What would be the right way to make this work properly (With that I mean run the rule only once when the interface goes up, and undo the rules when it goes down).