目标是绑定两块网卡:
- ens33
- ens34
0. 加载模块
modinfo bonding
modprobe --first-time bonding
lsmod | grep
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