linux撰写策略路由:
vim /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
252 old
251 new
250lo_2
ip route add src 192.168.3.232 dev em1 via 192.168.0.1 table old
ip rule add from 192.168.3.232 table old
ip route add src 192.168.9.24 dev em2 via 192.168.8.1 table new
ip rule add from 192.168.9.24 table new
ip route add src 192.168.9.211 via 192.168.8.1 table lo_2
ip rule add from 192.168.9.211 table lo_2
ip route flush table new && ip route flush table old && ip route flush table lo_2
删除策略路由:
ip route del src 192.168.3.232 dev em1 via 192.168.0.1 table old
ip rule del from 192.168.3.232 table old
ip route del src 192.168.9.24 dev em2 via 192.168.8.1 table new
ip rule del from 192.168.9.24 table new
ip route del src 192.168.9.211 via 192.168.8.1 table lo_2
ip rule del from 192.168.9.211 table lo_2
/etc/init.d/network restart