Home >System Tutorial >LINUX >CentOS7 Network Adapter Bonding Configuration Guide
NIC (Network Interface Card) bonding is also called network bonding. It can be defined as an aggregation or combination of multiple NICs to a single key interface. Its main purpose is to provide high availability and redundancy.
Experimental environment: DELL CentOS 7
Dual network card: em1/em2
# Check the network card name
ip link | awk 'NR%2==1' | awk '{print $2,$8,$9}' | tr -d ':' | grep -v lo | awk '{print $1}'
prerequisites
Confirm whether the bonding module has been loaded into the Linux environment, use the following command to load it:
modprobe bonding
List bound module information
modinfo bonding
Step one: Create binding interface file
Create the bonding interface file (ifcfg-bond0) under the folder "/etc/sysconfig/network-scripts/"
[root@kvm-centos7 ~]# cd /etc/sysconfig/network-scripts/
[root@kvm-centos7 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
TYPE=Bond
NAME=bond0
BONDING_MASTER=yes
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.133
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BONDING_OPTS="mode=5 miimon=100"Use 'mode = 5' to provide fault tolerance and load balancing
Step 2: Edit the NIC interface file (ifcfg-em1, ifcfg-em2)
[root@kvm-centos7 network-scripts]# clear
[root@kvm-centos7 network-scripts]# cat ifcfg-em1
TYPE=Ethernet
BOOTPROTO=none
UUID=f6f140af-1885-47d6-b22f-51e232d966e9
DEVICE=em1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@kvm-centos7 network-scripts]# cat ifcfg-em2
UUID=fe4606d1-23b8-48c7-a7e0-c858978ba4a9
DEVICE=em2
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
Step 3: Restart the network service
systemctl restart network.service
Step 4: Test and verify bond interface
Use ipconfig to check the network card status
View bonding interface settings, such as bonding mode and slave interface
cat /proc/net/bonding/bond0
Step 5: Fault Tolerance Test
Test fault tolerance, stop a network card to see if the server can be accessed and the interface status
ifdown em1 #Disable
ifconfig checks the network status and finds that the network status is normal
The above is the detailed content of CentOS7 Network Adapter Bonding Configuration Guide. For more information, please follow other related articles on the PHP Chinese website!