1,安装bonding需要的软件
 

sudo apt-get install ifenslave

 

2,在/etc/modules中加入:
 

bonding mode=1 miimon=100

 

3,在/etc/network/interfaces中加入:
 

auto bond0
iface bond0 inet static
address 10.128.1.12
netmask 255.255.255.0
gateway 10.128.1.200
post-up ifenslave bond0 eth0 eth1
pre-down ifenslave -d bond0 eth0 eth1

 


#静态路由设定
up route add -host 10.128.0.1 gateway 10.128.1.254
up route add -net 10.128.3.0 mask 255.255.255.0 gateway 10.128.1.254

 


#重启服务器(加载模块,需重启生效)

说明:
miimon是用来进行链路监测的。比如:miimon=100,那么系统每100ms监测一次链路连接状态,如果有一条线路不通就转入另一条线路;mode的值表示工作模式,他共有0,1,2,3四种模式,常用的为0,1两种。
 
mode=0表示load balancing (round-robin)为负载均衡方式,两块网卡都工作,带宽加倍。
mode=1表示fault-tolerance (active-backup)提供冗余功能,工作方式是主备的工作方式,默认情况下只有一块网卡工作,另一块做备份。
bonding只能提供链路监测,即从主机到交换机的链路是否接通。
如果只是交换机对外的链路down掉了,而交换机本身并没有故障,那么bonding会认为链路没有问题而继续使用。

相关文章:

  • 2021-07-07
  • 2021-10-10
  • 2022-12-23
  • 2022-01-26
  • 2021-12-21
  • 2021-09-02
  • 2022-12-23
  • 2021-04-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
相关资源
相似解决方案