第一步:编辑/etc/iproute2/rt_tables文件

vi /etc/iproute2/rt_tables

100 tel

200 cnc

第二步:执行命令(最好把下面的内容加载启动文件/etc/rc.local中)

sudo /sbin/ip rule add from 10.1.1.2(ip地址)/25 table 100

sudo /sbin/ip route add default via 10.1.1.1(缺省网关) dev em1 table 100


sudo /sbin/ip rule add from 192.168.1.2/27 table 200

sudo /sbin/ip route add default via 192.168.1.1 dev em2 table 200

##############################################################################

sudo /sbin/ip rule add from 125.76.226.91/25 table 100

sudo /sbin/ip route add default via 125.76.226.1 dev em1 table 100


sudo /sbin/ip rule add from 123.138.29.211/27 table 200

sudo /sbin/ip route add default via 123.138.29.193 dev em2 table 200