在/etc/iproute2/rt_tables里建2个table
251 tel
252 cnc
然后给这2个table加规则
ip rule add from 122.227.173.12 table tel
ip rule add from 60.12.21.139 table cnc
给table加路由
ip route add 122.227.173.8/29 src 122.227.173.12 dev eth0 table tel
ip route add 127.0.0.0/8 dev lo table tel
ip route add default via 122.227.173.9 dev eth0 src 122.227.173.12 table tel
ip route add 60.12.21.136/29 src 60.12.21.139 dev eth1 table cnc
ip route add 127.0.0.0/8 dev lo table cnc
ip route add default via 60.12.21.137 dev eth1 src 60.12.21.139 table cnc
注释:
122.227.173.12 电信线路地址
60.12.21.139 网通线路地址
122.227.173.8/29 电信网络地址
60.12.21.136/29 网通网络地址
122.227.173.9 电信网关
60.12.21.137 网通网关
阅读(603) | 评论(1) | 转发(0) |