Monday, 23 December 2024

Set up LACP bonding interface on CentOS 8

In this article, we’ll look at how to set up LACP bonding on a server running CentOS 8. LACP bonding uses the Link Aggregation Control Protocol to combine two network interfaces into one logical interface. Today, we’ll use it to combine two ethernet interfaces. This is useful to increase the throughput from each ethernet device and to provide for a way to failover if there’s an error with one of the devices.

Prerrequisites

  • Cloud VPS or Dedicated Server with CentOS 8 installed.

  • The network switch of your server must be set up for a successful procedure

  • Two active physical network interface connected to your switch

  • You must be logged in via SSH as sudo or root user. This tutorial assumes that you are logged in as a sudo user.

Step 1: Log in using SSH

You must be logged in via SSH as sudo or root user. Please read 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!

systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

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 8. We need to load it manually:

sudo modprobe bonding

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

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

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: Create the bonding interface

Create a new bonding configuration file:

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

Add the following lines to the bonding configuration file:

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

Step 6: Configure the network interface

In our article, we use eno1 and eno2 for 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 eno1.

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

Replace the configuration file with these lines:

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

Edit the configuration file of network interface en2:

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

Replace the configuration file with these lines:

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

Step 7: Reboot

sudo reboot

Link: https://www.snel.com/support/set-up-lacp-bonding-interface-on-centos-8/

NOC-RD, is part of NOCPERU. We consider as an important factor that your company or organization received all the facilities to achieve the objetives they seek

Contact Us

Trujillo, La Libertad, Perú
01 641 1239
044 64 3108
01 305-749-5753
+51 902 524 298

Social Link