首页 > 代码库 > Linux双网(联通/电信)双IP原路返回路由设置

Linux双网(联通/电信)双IP原路返回路由设置

# 配置ip

# /etc/iproute2/rt_tables增加2个路由表
200 telecom
201 unicom

# /etc/rc.local添加原路返回路由(可以将以下内容写入/etc/init.d/networking脚本中)
ip route flush table telecom
ip route add default via 113.142.37.129 dev em2 src 113.142.37.155 table telecom
ip rule add from 113.142.37.155 table telecom

ip route flush table unicom
ip route add default via 113.200.114.225 dev em3 src 113.200.114.237 table unicom
ip rule add from 113.200.114.237 table unicom

(exit 0)