双网卡双公网IP绑定

vi /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
252 uni
251 mobi
0 unspec
#
# local
#
#1 inr.ruhep

 

modprobe 8021q
vconfig add eth1 350
ifconfig eth1.350 192.168.2.191 netmask 255.255.255.128 up
vconfig add eth1 360
ifconfig eth1.360 172.20.2.143 netmask 255.255.255.128 up
ip route flush table uni
ip route add default via 192.168.2.254 dev eth1.350 src 192.168.2.191 table uni
ip rule add from 192.168.2.191 table uni
ip route flush table mobi
ip route add default via 172.20.2.254 dev eth1.350 src 172.20.2.143 table mobi
ip rule add from 172.20.2.143 table mobi

完成后需要将如上命令写成脚本加入rc.locl

posted @ 2017-12-11 16:43  lordhaart  阅读(270)  评论(0编辑  收藏  举报