How to set up LACP bonding interface on CentOS 6

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.

Prerequisites

  • The network switch of your server must be set up for a successful procedure
  • SSH login details
  • Two active physical network interface connected to your switch

Step 1 – Log in using SSH

You must be logged in via SSH as sudo or root user. Please view this article for instructions if you don’t know how to connect.

Step 2 – Disable NetworkManager

Within a server environment, we prefer to disable NetworkManager. These instructions won’t work if NetworkManager is enabled!

sudo service NetworkManager stop
sudo chkconfig NetworkManager off

Once the NetworkManager is disabled remove it

sudo yum -y remove NetworkManager NetworkManager-libnm NetworkManager-team NetworkManager-tui NetworkManager-wifi

Step 3: Load kernel module

The bonding module is not loaded by default in CentOS 6. We need to load it manually.

sudo modprobe bonding

To ensure that the kernel module bondingis loaded during boot we need to add the module into the modules configuration file

sudo su -c 'echo "bonding" >> /etc/modules'

Check if the bonding module is loaded

sudo lsmod |grep bonding

The output should be similar to this if the bonding module is loaded

bonding               133013  0

Step 4 – find the active network interface

clear && echo $(ip -o -4 route get 8.8.8.8 | sed -nr 's/.*dev ([^\ ]+).*/\1/p')

Step 5 – Configure the network interface

In our article we use eth0and eth1for the network interfaces. In your server environment, the network interface can be different. You have to use the network interface name you get back from step 4.

Edit the configuration file of network interface eth0

sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0

Replace the configuration file with these lines

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

Edit the configuration file of network interface eth1

sudo nano /etc/sysconfig/network-scripts/ifcfg-eth1

Replace the configuration file with these lines

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

Step 6 – Create the bonding

Create a new bonding configuration file

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

Step 7 – Reboot

sudo reboot

Step 8 – Check bonding interface status

sudo cat /proc/net/bonding/bond0

Output

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
Active Aggregator Info:
	Aggregator ID: 2
	Number of ports: 2
	Actor Key: 9
	Partner Key: 20004
	Partner Mac Address: cc:4e:24:a7:83:80

Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:25:90:57:23:57
Aggregator ID: 2
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:25:90:57:23:56
Aggregator ID: 2
Slave queue ID: 0

Conclusion

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

Was this article helpful?
Dislike 2
Views: 4032

Reader Interactions

Comments

  1. Jeffrey Ross says

    You've omitted to specify the contents of ifcfg-bond0 in Step 6, and this is critical, so someone following your instructions will fail. You also haven't warned/reminded the user in Step 7 that rebooting with these changes will prevent their machine from being connected to via these network interfaces if this change is not coordinated with the change in the network switch.

    • Ahmet Bas says

      The Prerequisites are as followed:
      – The network switch of your server must be set up for a successful procedure
      – Two active physical network interface connected to your switch

      This should be done before starting otherwise this will not work.

Leave a Reply

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