编辑文件
vi /etc/iproute2/rt_tables
# # reserved values # 255 local 254 main 253 default 252 table1 251 table2 0 unspec # # local # #1 inr.ruhep
添加
252 table1
251 table2
若有更多规则IP同理
103.243.101.1为默认出口网关
103.61.221.1为另一个IP网关
执行下面命令或把下面命令加入开机自动运行
ip route flush table table1 ip route add default via 103.243.101.1 dev eth1 src 103.243.101.8 table table1 ip rule add from 103.243.101.8 table table1 ip route flush table table2 ip route add default via 103.61.221.1 dev eth0 src 103.61.221.89 table table2 ip rule add from 103.61.221.89 table table2