How to set up LACP bonding interface on CentOS 7

Estimated reading time: 2 min

Introduction

A bonding network interface could be used for redundancy or higher speed requirements than 1 NIC can offer. This tutorial will help you set up an LACP (IEEE 802.3ad) bonding network interface. It requires that the switch of your server is connected to its set up accordingly. If you’re unsure please contact our support team.

Step 1: Log in with SSH

Log in as root. Please see this article for instructions if you don’t know how to connect.

Step 2: Disable NetworkManager

In our experience, NetworkManager is pretty unpredictable and near useless within a server environment and we prefer to disable NetworkManager. These instructions won’t work if NetworkManager is enabled!

systemctl stop NetworkManager
systemctl disable NetworkManager

Step 3: Configure nameservers

Because NetworkManager is now disabled you need to set up your name servers manually. Open /etc/resolv.conf with your favorite text editor:

nano /etc/resolv.conf

The content of that file should be as follows:

nameserver 89.207.128.252
nameserver 89.207.130.252

Step 4: Load bonding kernel module

modprobe bonding

Step 5: Create bonding interface configuration file

Create a new configuration file called ifcfg-bond0 in the directory /etc/sysconfig/network-scripts. We use our favorite text-editor nano to do so:

nano /etc/sysconfig/network-scripts/ifcfg-bond0

We will give this file the following content:

DEVICE=bond0
Type=Bond
NAME=bond0
BONDING_MASTER=yes
BOOTPROTO=none
ONBOOT=yes
IPADDR=89.207.131.xx
PREFIX=24
GATEWAY=89.207.131.1
NM_CONTROLLED=no
BONDING_OPTS="mode=4 miimon=100 lacp_rate=1"

Please replace the IP address on the line IPADDR=89.207.131.xx with the main IP address of your server and GATEWAY=89.207.131.1 with the gateway which is correct for your IP address.

Step 6: Update physical interface configuration files

It’s time to update the physical interface configuration files. Our server uses enp6s0 and enp7s0 as interfaces, so we start with enp6s0:

nano /etc/sysconfig/network-scripts/ifcfg-enp6s0

The content of this file is:

DEVICE=enp6s0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes

We update enp7s0 next:

nano /etc/sysconfig/network-scripts/ifcfg-enp7s0

The content of this file is:

DEVICE=enp7s0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes

Step 8: Reboot

Reboot your server with:

reboot

Step 9: Check bonding interface status

After reboot, your server should have bonding active. Check with:

cat /proc/net/bonding/bond0

The output should be something like:

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0 802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: 00:25:90:XX:XX:XX
Active Aggregator Info:
Aggregator ID: 2
Number of ports: 2
Actor Key: 9
Partner Key: 20002
Partner Mac Address: cc:4e:24:XX:XX:XX Slave Interface: enp6s0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:25:90:XX:XX:XX
Slave queue ID: 0
Aggregator ID: 2
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
system mac address: 00:25:90:XX:XX:XX
port key: 9
port priority: 255
port number: 1
port state: 63
details partner lacp pdu:
system priority: 1
system mac address: cc:4e:24:XX:XX:XX
oper key: 20002
port priority: 1
port number: 6
port state: 63 Slave Interface: enp7s0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:25:90:XX:XX:XX
Slave queue ID: 0
Aggregator ID: 2
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
system mac address: 00:25:90:XX:XX:XX
port key: 9
port priority: 255
port number: 2
port state: 63
details partner lacp pdu:
system priority: 1
system mac address: cc:4e:24:XX:XX:XX
oper key: 20002
port priority: 1
port number: 262
port state: 63

Conclusion

Congratulations, you have setup LACP bonding network interface according to IEEE 802.3ad.

Was this article helpful?
Dislike 1
Views: 90671

Reader Interactions

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *