How to configure bonding in CentOS7

02-07-2023

This article mainly introduces the relevant knowledge about how to configure bonding in CentOS7. The content is detailed and easy to understand, the operation is simple and fast, and it has certain reference value. Get up and see.

The goal is to bind two network cards:
  • ens33

  • ens34

0. Load module

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. Configure bond

mode0 (balanced load mode): usually both network cards work, and automatically backup However, port aggregation needs to be performed on the switch device connected to the local network card of the server to support the binding technology.
mode1 (automatic backup mode): Usually only one network card works, and it will be automatically replaced by another network card after it fails.
mode6 (balanced load mode): usually both network cards work, and automatic backup, without auxiliary support provided by the switch device. The time for automatic switchover in the event of a failure is 100 milliseconds.

  • vim /etc/modprobe.d/bond.conf

alias bond0 bonding options bond0 miimon=100 mode=6

  • Enable service

systemctl restart network


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us