您的位置:首页 > 运维架构 > Linux

linux 双网卡互通配置

2013-12-10 18:40 225 查看
ubuntu下
#!/bin/sh
#前提用联通IP登录系统
cp /etc/iproute2/rt_tables /etc/iproute2/rt_tables.bak
# telecom
#echo 200 telecom >> /etc/iproute2/rt_tables
#unioncom
#echo 201 unioncom >> /etc/iproute2/rt_tables
ip route add 122.193.101.51/29 dev eth0 src 122.193.101.51 table liantong
ip route add default via 122.193.101.49 table liantong
ip route add 222.92.154.139/29 dev eth1 src 222.92.154.139 table dianxin
ip route add default via 222.92.154.137 table dianxin
ip route add 122.193.101.51/29 dev eth0 src 122.193.101.51
ip route add 222.92.154.139/29 dev eth1 src 222.92.154.139
#更换试试
ip route add default via 222.92.154.137
#liangtong
ip rule add from 122.193.101.51 table liantong
#dianxin
ip rule add from 222.92.154.139 table dianxin

redhat
双网卡,双公网IP,保持每个公网IP胡通
ip route add default via 180.153.154.1 dev eth0 src 180.153.154.155 table hengs01
ip route add default via 180.153.153.25 dev eth2 src 180.153.153.28 table hengs02
ip rule add from 180.153.154.155 table hengs01
ip rule add from 180.153.153.28 table hengs02
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息