How to bind / configure NIC teaming/bonding in CentOS / Oracle Linux / RedHat Linux

Following is an example of how to configure NIC teaming/bonding

1) create channel bonding interface
$ sudo vim /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
BOOTPROTO=none
IPADDR=192.168.1.199
NETMASK=255.255.254.0
GATEWAY=192.168.1.1
ONBOOT=yes
USERCTL=no
TYPE=Ethernet
DNS1=8.8.8.8
DNS1=8.8.4.4
IPV6INIT=no

$ sudo vim /etc/sysconfig/network-scripts/ifcfg-em1 (em2, em3 ...) and add/change the values:

TYPE=Ethernet
BOOTPROTO=none
IPV4_FAILURE_FATAL=no
NAME=em1

ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED=no

2)edit /etc/modprobe.d/

$ sudo vim /etc/modprobe.d/bond0.conf
alias bond0 bonding

3)config mode=4
#echo "802.3ad 4" > /sys/class/net/bond0/bonding/mode
( If you failed to modify the file content by vim, this echo command can help you)
( When your bonding is running, you may not be able to modify it, you may need to stop it by
systemctl stop network before you can modify it)
(optional, defaults to 'balance-rr 0')
If you configure an LACP bond to two separate switches.

Say you have the following:

+------+ +-----+
| eth0 =-----= sw1 |
| eth1 =-----= |
| | +-----+
| | +-----+
| eth2 =-----= sw2 |
| eth3 =-----= |
+------+ +-----+
Then'balance-rr 0' won't work. Change it to mode 4

4) Make sure that you have NetworkManager either inactive or uninstalled.

$ sudo service NetworkManager stop 
sudo systemctl disable NetworkManager
Or simply
$ sudo yum -y remove NetworkManager

5) #ifup bond0 or systemctl restart network
#modprobe -a bonding
#service network restart
(See also: Networking bonding mode of Linux)

To test it is working:

# modprobe bonding && service network restart && less /proc/net/bonding/bond0
$ ping it.goyun.info
PING ghs.l.google.com (74.125.70.121) 56(84) bytes of data.
64 bytes from 74.125.70.121: icmp_seq=1 ttl=44 time=35.7 ms
64 bytes from 74.125.70.121: icmp_seq=2 ttl=44 time=36.0 ms

list the interfaces seen by the system:
#ifconfig
#ip link
#ip addr

Comments