Nov 10, 2018

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

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

1) create channel bonding interface
$ sudo vi /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 vi /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 vi /etc/modprobe.d/bond0.conf
alias bond0 bonding

3)config mode=4
#echo "802.3ad 4" > /sys/class/net/bond0/bonding/mode
(optional, defaults to 'balance-rr 0')

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
#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.i88.ca
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