有人通过描述如何使用源策略路由创建新的路由表来回答我的
earlier question:
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
如何让这些“ip”命令在重启时保持不变?我假设有一些适当的行添加到/ etc / network / interfaces.这是正确的(向界面添加“向上”线),还是有其他方法可以做到这一点?
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
(我在Ubuntu 12.04上).