Mar 01
作者: 肖建彬 | 可以转载, 转载时务必以超链接形式标明文章原始出处和作者信息及版权声明
网址:http://www.xiaojb.com/archives/it/policyroute.shtml
网址:http://www.xiaojb.com/archives/it/policyroute.shtml
之前设置了一个这样的策略路由:
/etc/iproute2/rt_tables 198 pri 199 pub rc.policyrouter.sh ####私网 IP1=10.1.1.100 GW1=10.1.1.249 DEV1=eth0 TABLE1=pri ####公网 IP2=61.167.120.140 GW2=61.167.120.254 DEV2=eth1 TABLE2=pub ####私网默认 GW3=10.1.1.254 /sbin/ip route add 192.168.0.0/16 via $GW3 src $IP1 dev $DEV1 table $TABLE1 /sbin/ip route add 10.0.0.0/9 via $GW3 src $IP1 dev $DEV1 table $TABLE1 /sbin/ip route add default via $GW1 src $IP1 dev $DEV1 table $TABLE1 /sbin/ip rule add from $IP1 table $TABLE1 /sbin/ip route add default via $GW2 src $IP2 dev $DEV2 table $TABLE2 /sbin/ip rule add from $IP2 table $TABLE2 /sbin/ip route flush cache rc.policyrouter.sh加入rc.local里边去。
后发现F5在检查业务端口状态的时候经常失败,现象是从F5telnet 10.1.1.100 80超时,仔细检查了策略,原因是策略路由的级别高于table main,同一子网的路由也被指到了网关,导致了异常。
修改后的路由脚本是:
####私网 IP1=10.1.1.100 NET1=10.1.1.0/24 GW1=10.1.1.249 DEV1=eth0 TABLE1=pri ####公网 IP2=61.167.120.140 NET2=61.167.120.0/24 GW2=61.167.120.254 DEV2=eth1 TABLE2=pub ####私网默认 GW3=10.1.1.254 /sbin/ip route add $NET1 src $IP1 dev $DEV1 table $TABLE1 /sbin/ip route add 192.168.0.0/16 via $GW3 src $IP1 dev $DEV1 table $TABLE1 /sbin/ip route add 10.0.0.0/9 via $GW3 src $IP1 dev $DEV1 table $TABLE1 /sbin/ip route add default via $GW1 src $IP1 dev $DEV1 table $TABLE1 /sbin/ip rule add from $IP1 table $TABLE1 /sbin/ip route add $NET2 src $IP2 dev $DEV2 table $TABLE2 /sbin/ip route add default via $GW2 src $IP2 dev $DEV2 table $TABLE2 /sbin/ip rule add from $IP2 table $TABLE2 /sbin/ip route flush cache
Recent Comments