In the following of Linux tutorials, in this article, you will learn about NIC teaming in CentOS 7. But first, what is NIC? the Network Interface Card is also known as Network bonding which can be defined as the aggregation or combination of multiple NIC into a single bond interface. The main purpose of NIC is to provide high availability and redundancy.
Table of Contents
Prerequisite :
Your bonding module must be loaded on your Linux box. If it is not, use the below command.
[root@eldersrv ~]# modprobe bonding
NIC teaming in CentOS 7
Follow this guide to learn how to configure nic or network bonding in CentOS 7 & RHEL 7. we start with two interface cards (enp0s3 & enp0s8) and will form a bond interface (bond0).
List the bonding module-info:
[root@eldersrv ~]# modinfo bonding
1- Create a bond interface file
First , create a bond interface file (ifcfg-bond0) under the folder “/etc/sysconfig/network-scripts/”
[root@eldersrv network-scripts]# vi ifcfg-bond0 DEVICE=bond0 TYPE=Bond NAME=bond0 BONDING_MASTER=yes BOOTPROTO=none ONBOOT=yes IPADDR=192.168.10.70 NETMASK=255.255.255.0 GATEWAY=192.168.10.1 BONDING_OPTS="mode=5 miimon=100"
You can save and close the file now.
Next, specify the IP address, Netmask & bonding modes. Here we select ‘mode=5′ which is used to provide fault tolerance and load balancing.
2- Edit the NIC interface files
For ifcfg-eno1
[root@eldersrv ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno1 TYPE=Ethernet BOOTPROTO=none DEVICE=eno1 ONBOOT=yes HWADDR="08:00:26:79:60:b9" MASTER=bond0 SLAVE=yes
For ifcfg-eno2
[root@eldersrv ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno2 TYPE=Ethernet BOOTPROTO=none DEVICE=eno2 ONBOOT=yes HWADDR="08:00:26:ed:71:2d" MASTER=bond0 SLAVE=yes
3- Restart the Network Service
By the following command, you can restart the network service and bring the above changes into the effect.
[root@eldersrv ~]# systemctl restart network.service
4- Test and verify the bond interface
To check the bond interface along with its slave interfaces, Use ‘ifconfig‘ & ‘ip add‘ command.
To view bond interface settings like bonding mode and slave interface:
[root@eldersrv ~]# cat /proc/net/bonding/bond0
5- Fault tolerance testing
You can down one interface and check whether you are still able to access the server, to test the fault tolerance
[root@eldersrv ~]# ifdown eno1 Device ‘eno1’ successfully disconnected. [root@eldersrv ~]#
Good job! You learned how to configure NIC(Network Interface Card) bonding in CentOS 7 / RHEL 7.