Ubuntu bond 配置


1. 加载必要系统模块

临时加载:

  modprobe bonding
  modprobe 8021q

永久加载:

vim /etc/modules

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
bonding
8021q

2. vim /etc/network/interfaces, 例如eth1,eth2

auto eth1 iface eth1 inet manual bond-master bond0 auto eth2 iface eth2 inet manual bond-master bond0


auto bond0        ##bond名称
iface bond0 inet manual
bond-mode active-backup
bond-miimon 100
bond-slaves none

auto bond0.100
iface bond0.100 inet static
address 10.0.0.3
gateway 10.0.0.1
netmask 255.255.255.240
vlan-raw-device bond0

bond配置结束后,cat /proc/net/bonding/bond* 来查看bond的协商状态

3. 几种常见的bond mode,round-robin, active-backup, 802.3ad

##默认mode=0, round-robin模式,需要同时在交换机上配置链路聚合##
auto bond0
iface bond0 inet manual

##mode=1, active-backup 模式,顾名思义即为一主一备,交换机上不需要做额外配置##
auto bond0
iface bond0 inet manual
bond-mode active-backup
bond-miimon 100       ###多少ms检测一次网络
bond-slaves none

##mode=4, 802.3 ad模式,采用动态链路聚合策略,需要同时在交换机上配置动态链路聚合,##
auto bond0
iface bond0 inet manual
bond-mode 4
bond-miimon 100
bond-lacp-rate 1
bond-slaves none

mode 0和4的区别,0即为静态链路聚合,没有LACP报文交互,双方端口up,双工一致,链路就可以UP,因此不支持单链路故障备份。
4即为动态链路聚合,需要双方配置LACP,LACP写上成功,链路才可以UP,因此支持单链路故障备份。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM