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