CentOS7服务器(x3650M5)与QNAP TS453 NAS双网卡直连负载均衡配置问询
Alright, let's get your dual direct-connected NICs set up for load balancing. We'll use Linux bonding (NIC teaming) on the CentOS 7 server, and configure the QNAP NAS to match. Here's how to do it step by step:
Prerequisites
- Make sure
eno3andeno4are not currently configured (check withip addr show). - Have root access on both the server and NAS.
- Confirm the physical cables are properly connected:
eno3↔eth2,eno4↔eth3.
Step 1: Configure Bonding on CentOS 7
First, we'll create a bonded interface (bond0) that combines eno3 and eno4. We'll use mode 6 (adaptive load balancing) since it's perfect for direct connections—it balances traffic based on current load and handles failover automatically.
1.1 Create the bond interface config file
Create /etc/sysconfig/network-scripts/ifcfg-bond0 with these contents:
TYPE=Bond BOOTPROTO=static IPADDR=10.10.11.20 NETMASK=255.255.255.0 ONBOOT=yes BONDING_OPTS="mode=6 miimon=100"
mode=6: Adaptive load balancing (distributes traffic based on link usage, fails over if a NIC dies)miimon=100: Checks link status every 100ms to detect failures quickly
1.2 Configure the slave NICs
Update ifcfg-eno3 (delete any existing IP config, set it as a bond slave):
TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes NAME=eno3 DEVICE=eno3
Do the same for ifcfg-eno4:
TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes NAME=eno4 DEVICE=eno4
1.3 Restart networking and verify
Restart the network service to apply changes:
systemctl restart network
Check the bond status to confirm both NICs are active:
cat /proc/net/bonding/bond0
You should see both eno3 and eno4 listed as active slaves, with mode 6 enabled and link status marked as "up".
Step 2: Configure the QNAP NAS
Now we need to set up the NAS side to work with the bonded interface. You have two solid options here:
Option A: Bond the NAS's eth2 and eth3 (recommended)
This matches the server's setup for full load balancing and failover:
- Log into the QNAP web UI.
- Navigate to Control Panel > Network & File Services > Network & Virtual Switch.
- Click Create > Bonded Interface.
- Select
eth2andeth3as the member interfaces. - Choose Adaptive Load Balancing (ALB) as the mode (this aligns with CentOS's mode 6).
- Assign an IP address in the
10.10.11.x/24range, e.g.,10.10.11.21. - Apply the settings and wait for the NAS to restart its network services.
Option B: Assign static IPs to eth2 and eth3 (simpler, no bonding)
If you don't want to set up bonding on the NAS, just assign static IPs in the same subnet to both NICs:
- In the QNAP web UI, go to Network & Virtual Switch > Interfaces.
- Edit
eth2: Set IP to10.10.11.21/24, disable DHCP. - Edit
eth3: Set IP to10.10.11.22/24, disable DHCP. - Apply changes.
Note: Option A delivers true load balancing and automatic failover, while Option B works but doesn't actively distribute traffic between the two links.
Step 3: Test the Setup
- Connectivity test: From the server, ping the NAS's bond IP (or individual eth2/eth3 IPs):
ping 10.10.11.21 - Bandwidth test: Use
iperfto verify combined throughput:- On CentOS: Install with
yum install iperf - On QNAP: Install via App Center or use
opkg install iperfif you have Entware enabled - Run
iperf -son the NAS, theniperf -c 10.10.11.21on the server. You should see throughput close to the sum of both NICs (e.g., ~2Gbps for Gigabit NICs).
- On CentOS: Install with
- Failover test: Unplug one of the direct cables—traffic should automatically switch to the remaining NIC without any interruption.
Troubleshooting Tips
- If the bond isn't working, double-check that
miimonis set to100(standard for link monitoring). - Ensure no existing network configurations are conflicting with
eno3/eno4(delete any old IP settings if needed). - On the NAS, confirm the bonded interface mode is set to ALB (matches CentOS's mode 6) for full compatibility.
内容的提问来源于stack exchange,提问作者just_a_noob

