In the actual environment, the server through the network port binding technology, can easily realize the network port redundancy, load balancing, so as to achieve high availability, and can improve network performance, greatly improve network I/O.
In general, Linux's multi-port bindings use the "bonding" module in the kernel, which is already included in each Linux version kernel that is currently released.
Here's a demonstration of the binding process. Bind the test server's Eth2,eth3 two NIC to a logical interface.
First step : Create the configuration file of the logical interface BOND0;
# Vim Ifcfg-bond0
Device=bond0
Bootproto=none
Onboot=yes
ipaddr=192.168.5.49
netmask=255.255.255.0
dns2=202.96.128.86
gateway=192.168.5.1
dns1=202.96.134.133
The second step: Configure the Member interface;
To add a configuration to member ports:
Master=bond0
Slave=yes
The third step : Modify the modprobe related configuration file;
# echo "Alias bond0 bonding" >>/etc/modprobe.d/bonding.conf
# echo "Options bonding miimon=100 mode=1" >>/etc/modprobe.d/bonding.conf
Fourth Step : Load the Bonding module (if you restart the system, you do not need to manually load)
# modprobe Bonding
# Lsmod | grep bonding (Verify loading results)
Bonding 128245 0
Check the status of Bond's NIC after restarting the network service:
# cat/proc/net/bonding/bond0
Ethernet Channel Bonding driver:v3.6.0 (September 26, 2009)
Bonding mode:fault-tolerance (Active-backup)
Primary Slave:none
Currently Active Slave:eth2
MII Status:up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface:eth2
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:0
Permanent HW Addr:e8:bd:d1:04:e0:12
Slave Queue id:0
Slave Interface:eth3
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:0
Permanent HW addr:e8:bd:d1:04:e0:13
Slave Queue id:0
You can see an important message above.
- Mode, this is the mode=*** we configured, which we configured is 1.
- You can see that the current active network port is eth2
After doing the above operation, the binding is basically complete.
Typically, we work with the link aggregation capabilities of the switches to improve overall network performance. Here, we are using Huawei's 5700 switch, which enables the Eth-trunk feature and is configured in LACP mode.
The switch is configured as follows:
Interface Eth-trunk5
Description test-db-bond-169
Port Link-type Access
Port default VLAN 5
Mode LACP
Load-balance Src-ip
LACP preempt Enable
Max Active-linknumber 3
Note: Configure the switch to use Yes, the bound mode needs to be set to 4 (802.3AD)
Linux multi-port binding with Huawei 5700 Eth-trunk technology to improve network performance