How to setup LACP bonding interface on CentOS 7

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

How to setup LACP bonding interface on CentOS 7

Step 1) Login with SSH
Login as root.

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 setup your nameservers manually. Open /etc/resolv.conf with your favourite text-editor:
nano /etc/resolv.conf
The content of that file should be as follows:
nameserver 8.8.8.8
nameserver 4.4.4.4
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 favourite 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
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 7) Reboot
Reboot your server with:
reboot
Step 8) Check bonding interface status
After reboot your server should have bonding active. Check with:
cat /proc/net/bonding/bond0
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
Step 9) Finished
Congratulations, you have setup LACP bonding network interface according to IEEE 802.3ad.

Title : centos 7 teaming lacp | linux bonding mode 4 | rhel 7 lacp bonding | what is lacp bonding linux | lacp_rate | lacp_rate=1 | lacp bonding mode 4 | linux bonding lacp passive

Artikel Terkait


EmoticonEmoticon