ISP1:192.168.160.2
ISP2:172.16.250.2
Eth0:192.168.160.128
Eth1:172.16.250.128
企业双线接入方案
1 建立路由策略表
[root@node1 ~]# vi /etc/iproute2/rt_tables
100 tele1
102 tele2
添加如上两行
建立各个ISP网络对对应接口的路由
Ip route add 192.168.160.0/24 dev eth0 src 192.168.160.128 table tele1
Ip route add 172.16.250.0/24 dev eth1 src 172.16.250.128 table tele2
添加各个ISP的网关
Ip route add default via 192.168.160.2 table tele1
Ip route add default via 172.16.250.2 table tele2
添加路由策略从各个接口发送的数据可以发送到到各个ISP的路由表上面
Ip rule add from 192.168.160.128 table tele1
Ip rule add from 172.16.250.128 table tele2
添加一个默认网关
Ip route add default via 172.16.250.2 dev eth1
Ip route show
[root@cluster2 ~]# ip route list
192.168.228.0/24 dev eth1 proto kernel scope link src 192.168.228.128
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.180
169.254.0.0/16 dev eth1 scope link
default via 192.168.228.128 dev eth1
以上实现了从哪里来从哪里出去(从出口路由器的角度来考虑)
做负载均衡,带宽加起来!
删除上面的网关
Shell> Ip route del default via 172.16.250.2
Shell> Ip route add default scope global nexthop via 192.168.160.2 dev eth0 weight 1 nexthop via 172.16.250.2 dev eth1 weight 1
[root@cluster2 ~]# ip route list
192.168.228.0/24 dev eth1 proto kernel scope link src 192.168.228.128
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.180
169.254.0.0/16 dev eth1 scope link
default
nexthop via 192.168.0.180 dev eth0 weight 1
nexthop via 192.168.228.128 dev eth1 weight 1
by huzi1986