Somebody answered my earlier question by describing how to create a new routing table with source policy routing:
echo 13 eth3 >> /etc/iproute2/rt_tables
ip route add default via 10.20.0.1 table eth3
ip rule add from 10.20.0.2 lookup eth3
How do I make those "ip" commands persist across a reboot? I assume that there's some appropriate lines to be added to /etc/network/interfaces
. Is this the right away (adding "up" lines to the interface), or is there another way to do it?
iface eth3 inet static
address 10.20.0.2
netmask 255.255.255.0
up ip route add default via 10.20.0.1 table eth3
up ip rule add from 10.20.0.2 lookup eth3
down ip rule del from 10.20.0.2 lookup eth3
down ip route del default via 10.20.0.1 table eth3
(I'm on Ubuntu 12.04).