天天看點

CentOS7配置bonding簡法

目标是綁定兩塊網卡:

  • ens33
  • ens34

0. 加載子產品

modinfo bonding
modprobe --first-time bonding
lsmod | grep bond
           

1. vim /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
DEVICE=ens33
MASTER=bond0
SLAVE=yes
           

2. vim /etc/sysconfig/network-scripts/ifcfg-en

TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
DEVICE=ens34
MASTER=bond0
SLAVE=yes
           

3. vim /etc/sysconfig/network-scripts/ifcfg-bond0

TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
DEVICE=bond0
IPADDR=192.168.10.10
PREFIX=24
DNS=192.168.10.1
NM_CONTROLLED=no
           

4. 配置bond

mode0(平衡負載模式):平時兩塊網卡均工作,且自動備援,但需要在與伺服器本地網卡相連的交換機裝置上進行端口聚合來支援綁定技術。

mode1(自動備援模式):平時隻有一塊網卡工作,在它故障後自動替換為另外的網卡。

mode6(平衡負載模式):平時兩塊網卡均工作,且自動備援,無須交換機裝置提供輔助支援。出現故障時自動切換的時間為100毫秒。

  • vim /etc/modprobe.d/bond.conf
alias bond0 bonding
options bond0 miimon=100 mode=6
           
  • 啟用服務
systemctl restart network
           

參考文獻

  • https://www.linuxprobe.com/chapter-09.html
  • https://www.linuxprobe.com/linux-pre-net.html

繼續閱讀