TL;DR
The caveat with bonding two ethernet interfaces using CentOS 7 is that network manager might interfere with your setup. The below configuration explicitly tells network manager to not control the configuration.
Bond Interface
cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
IPADDR=192.168.1.20
PREFIX=24
GATEWAY=192.168.1.1
DNS1=1.1.1.1
ONBOOT=yes
BOOTPROTO=none
BONDING_OPTS=”mode=4 miimon=100″
NM_CONTROLLED=no
mode=4 means IEEE 802.3ad Dynamic link aggregation. This works well with Ubiquiti switches.
Ethernet 1
cat /etc/sysconfig/network-scripts/ifcfg-eno1 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=eno1 UUID=bdbc0548-e3e1-4ebf-aa64-1d950ccad2f2 DEVICE=eno1 ONBOOT=yes MASTER=bond0 SLAVE=yes NM_CONTROLLED=no
Ethernet 2
cat /etc/sysconfig/network-scripts/ifcfg-eno2 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=eno2 UUID=74f0a345-d85e-4c55-9c71-9834e13c4f7d DEVICE=eno2 ONBOOT=yes MASTER=bond0 SLAVE=yes NM_CONTROLLED=no
Disabling NetworkManager
This will allow you to use network
instead.
If you’re having trouble, this is how to troubleshoot (and disable) nmcli
service NetworkManager status
If it’s running, then:
nmcli device status
This will indicate what’s managed by network manager.
service NetworkManager stop systemctl disable NetworkManager systemctl enable network