Linux allows administrators to bind multiple network interfaces together into a single channel using the bonding kernel module and a special network interface called a channel bonding interface. Channel bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy. Network Bonding is a kernel feature and also known as NIC teaming.
Let’s assume we are configuring bond0 with interfaces ifcfg-enp25s0f0 and ifcfg-enp25s0f1
We need to create a channel bonding interface configuration file on /etc/sysconfig/network-scripts/ directory called ifcfg-bond<N> replacing <N> with the number for the interface, such as 0 and specify the bonding parameters on the file. Here we are creating ifcfg-bond0 file with following contents:
# cat ifcfg-bond0
or
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.20.10.11
NETMASK=255.255.255.0
GATEWAY=10.20.10.1
BONDING_OPTS="mode=4 miimon=200"
# cat ifcfg-bond1
DEVICE=bond1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.20.10.11
NETMASK=255.255.255.0
GATEWAY=10.20.10.1
MTU=9000
BONDING_OPTS="mode=802.3ad miimon=100 lacp_rate=slow xmit_hash_policy=layer2+3"
Below are the bonding modes:
- mode=0 (Balance Round Robin)
- mode=1 (Active backup)
- mode=2 (Balance XOR)
- mode=3 (Broadcast)
- mode=4 (802.3ad)
- mode=5 (Balance Transmit Load Balance (TLB))
- mode=6 (Balance Adaptive Load Balance (ALB))
After the channel bonding interface is created, the network interfaces to be bound together and configured by adding the MASTER= and SLAVE= directives to their configuration files. Below are the interface files:
# cat ifcfg-enp25s0f0
DEVICE=enp25s0f0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
IPV6INIT=no
MASTER=bond0 #or bond1
SLAVE=yes
#cat ifcfg-enp25s0f1
DEVICE=enp25s0f1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
IPV6INIT=no
MASTER=bond0 #or bond1
SLAVE=yes
DEVICE=enp25s0f0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
IPV6INIT=no
MASTER=bond0 #or bond1
SLAVE=yes
#cat ifcfg-enp25s0f1
DEVICE=enp25s0f1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
IPV6INIT=no
MASTER=bond0 #or bond1
SLAVE=yes
Now, load the bond driver, bring up the newly created bond0 or bond1 interface and verify the same by following commands:
# modprobe bonding
# ifconfig bond0 up
# ifconfig
# ip a
# cat /proc/net/bonding/bond0
# cat /proc/net/bonding/bond0
Cheers :-)