tencent cloud

TencentOS Server

NIC Bonding Configuration

Download
Focus Mode
Font Size
Last updated: 2026-10-19 17:22:50
AI-Translated

Overview

This document describes how to configure NIC bonding (link aggregation) on TencentOS Server 4 to achieve network bandwidth aggregation or link redundancy by binding multiple physical NICs into a single logical interface.
Common Bond modes:
Mode
Term
Characteristic
Applicable Scenarios
mode 0
balance-rr
Round robin, CLB (requires switch support for link aggregation)
Maximized throughput
mode 1
active-backup
Primary/secondary, high availability
Link redundancy
mode 2
balance-xor
Hash-based CLB
CLB
mode 4
802.3ad (LACP)
Dynamic link aggregation (requires switch support for LACP)
High throughput + redundancy
mode 5
balance-tlb
Adaptive Transmit Load Balancing
Egress bandwidth balancing
mode 6
balance-alb
Adaptive Load Balancing
Bidirectional bandwidth balancing

Prerequisites

Permission requirements: root privileges
Multiple NICs: at least 2 physical NICs (this example uses eth0 and eth1)
If mode 4 (LACP) is used, configure the port aggregation group on the switch accordingly.
Note:
Configuring Bond changes the NIC status. If you are connecting to the server over SSH through one of the NICs, the connection may be interrupted. We recommend that you perform the operation through an out-of-band management channel, such as BMC/IPMI or the cloud platform console. If only SSH is available, keep multiple independent connections open and avoid disconnecting the session in use.

Method 1: Using NetworkManager (Recommended)

TencentOS Server 4 uses NetworkManager to manage networks by default. We recommend that you use the nmcli command for configuration.

Step 1: Creating a Bond Interface

# Create a Bond connection named bond0 (mode 1: primary/secondary mode)
nmcli connection add type bond \\
con-name bond0 \\
ifname bond0 \\
bond.options "mode=active-backup,miimon=100"

# LACP mode (mode 4, requires switch configuration)
nmcli connection add type bond \\
con-name bond0 \\
ifname bond0 \\
bond.options "mode=802.3ad,miimon=100,lacp_rate=fast"

Step 2: Adding Member NICs (Slaves)

# Add eth0 as a slave of bond0
nmcli connection add type ethernet \\
con-name bond0-slave-eth0 \\
ifname eth0 \\
master bond0

# Add eth1 as a slave of bond0
nmcli connection add type ethernet \\
con-name bond0-slave-eth1 \\
ifname eth1 \\
master bond0

Step 3: Configuring the IP Address of the Bond Interface

# Configure a Static IP
nmcli connection modify bond0 \\
ipv4.addresses "192.168.1.100/24" \\
ipv4.gateway "192.168.1.1" \\
ipv4.dns "8.8.8.8,114.114.114.114" \\
ipv4.method manual

# Or configure DHCP
nmcli connection modify bond0 ipv4.method auto

Step 4: Enabling the Connection

# Enable the slave connection
nmcli connection up bond0-slave-eth0
nmcli connection up bond0-slave-eth1

# Enable the Bond connection
nmcli connection up bond0

Step 5: Disabling the Standalone IP address Connection of the Original NIC (Optional)

# Disable the standalone connections of eth0 and eth1 to prevent IP conflicts.
nmcli connection modify eth0 connection.autoconnect no
nmcli connection modify eth1 connection.autoconnect no

Method 2: Using Configuration Files (Traditional Method)

Bond Primary Interface Configuration

Edit the vim /etc/NetworkManager/system-connections/bond0.nmconnection file and change type = bond.
[connection]
id=bond0
type=bond
interface-name=bond0
autoconnect=yes

[bond]
mode=active-backup
miimon=100

[ipv4]
method=manual
address1=192.168.1.100/24,192.168.1.1
dns=8.8.8.8;114.114.114.114;

[ipv6]
method=ignore
Slave NIC configuration (eth0):
[connection]
id=bond0-slave-eth0
type=ethernet
interface-name=eth0
master=bond0
slave-type=bond
autoconnect=yes
Reload the configuration:
nmcli connection reload
nmcli connection up bond0
Verify.
# Check the Bond interface status
cat /proc/net/bonding/bond0

# Check the network connection status.
nmcli connection show

# Verify the IP address
ip addr show bond0

# Check the Bond member status
ip link show
Example output of /proc/net/bonding/bond0 (active-backup mode):
Ethernet Channel Bonding Driver: v5.15.0

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: eth0 (primary_reselect failure)
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xx
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xx
Slave queue ID: 0

FAQs

Problem: Traffic remains concentrated on a single NIC after mode 4 (LACP) is configured.
Traffic distribution in mode 4 is based on a hash algorithm (layer2 by default, which is based on MAC addresses). All packets of the same TCP session are transmitted over the same member link. To achieve more fine-grained load balancing, adjust the hash policy:
nmcli connection modify bond0 bond.options "mode=802.3ad,miimon=100,xmit_hash_policy=layer3+4"
layer3+4 performs hashing based on IP addresses and ports, distributing traffic from different connections more evenly.
Problem: The Bond interface cannot obtain a DHCP address.
Check whether independent IP address configuration is not enabled on the member NICs (eth0/eth1):
nmcli connection show eth0 | grep autoconnect
Problem: Bond configuration is lost after a restart.
Confirm that the NetworkManager configuration file exists and is correct:
ls /etc/NetworkManager/system-connections/
nmcli connection reload
nmcli connection show


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback