Hamsa K
6 min read | 3 years ago

How to Configure NIC bonding on Centos 7

configure NIC (Network interface card ) bonding on centos 7

NIC (Network Interface Card) bonding is also known as Network bonding. It is a combination of two or more NICs into a single bond interface.It provide a high availability and redundancy.

In this article we will learn how to configure netwok bonding on centos 7 server.

First,we need to enable the bondingl module. In CentOS/RHEL it is not enabled by default and you can check with lsmod

lsmod | grep bonding

If it is not enabled, enable it using the following command.

modprobe bonding

Now create bond interface file 

vim /etc/sysconfig/network-scripts/ifcfg-bond0

Add the following into above file.

BONDING_OPTS="mode=5 miimon=100"

Also Read -> How to Change TimeZone in Centos 7

Here is the followig bonding types

(balance-rr) ---> mode=0
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.

(active-backup) ---> mode=1
Active-backup policy: Only one slave in the bond is active. A different slave becomes active if the active slave fails.This mode provides fault tolerance.

XOR [exclusive OR] ---> mode=2

In this mode the, the MAC address of the slave NIC is matched up against the incoming request’s MAC and once this connection is established same NIC is used to transmit/receive for the destination MAC.This mode provides load balancing and fault tolerance.

Broadcast ---> mode=3

All transmissions are sent on all slaves.This mode provides fault tolerance.

Dynamic Link Aggregation ---> mode=4

This mode is known as a Dynamic Link Aggregation mode that has it created aggregation groups having same speed. It requires a switch that supports IEEE 802.3ad dynamic link. The slave selection for outgoing traffic is done based on a transmit hashing method.This mode requires an 802.3ad-compliant network switch.

Transmit Load Balancing (TLB) ---> mode=5

The outgoing traffic is distributed depending on the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave.This mode does not require any special switch support.

Adaptive load balancing (ALB) ---> mode=6

This mode includes transmit load balancing (tlb) and receive load balancing (rlb) for IPv4 traffic and does not require any special switch support. Receive load balancing is achieved by ARP negotiation.

Now edit NIC interface files

For enp0s3

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

Add below content to it.


For enp0s8

vi /etc/sysconfig/network-scripts/ifcfg-enp0s8

Add following content to above file.


Then restart Network Service with the following command.

systemctl restart network

now you can check whether the bonding interface bond0 is up and running with the following command.

 cat /proc/net/bonding/bond0

sample putput:

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: transmit load balancing
Primary Slave: None
Currently Active Slave: enp0s3
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: enp0s3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 08:00:27:08:d7:55
Slave queue ID: 0
Slave Interface: enp0s8
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 08:00:27:e5:0e:b3
Slave queue ID: 0

Test fault tolerance

To test if the network bonding is working or not, bring one of the network interfaces down. To do that run as below.

ifdown enp0s3

you can verify by making a http or ssh request to the server via the bonding interface IP address, network should be working just fine and agian check with below command which interface is up or down.

cat /proc/net/bonding/bond0

That's it. now you have successfully configured NIC bonding on centos 7 server.

Also Read -> How to Install Varnish with Apache on Centos 7

Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy