How to Create NIC Bonding in RedHat/CentOS 5/6

Linux allows binding of multiple network interfaces into a single NIC using special kernel module called bonding. Bonding is Linux kernel feature that allows to aggregate multiple interfaces into a single virtual link. If one physical NIC is down then automatically all the resource move to other NIC card. Channel bonding will work with the help of bonding driver in kernel. In this article we will help you how to create NIC Bonding.

NIC Bonding

Step #1 Create a Bond Configuration File

You need to create bond configuration file in “/etc/sysconfig/network-scripts” directory like the below one:

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

Append the following line:

DEVICE=bond0
IPADDR=192.168.5.30
NETWORK=192.168.5.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes

Step #2 Modify Network Configuration Files

Now modify the network configuration file by adding the Master and Slave directives.
For eth2

# vim /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

For eth3

# vim /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Step #3 Creating Bonding Channel

Create bonding.conf file to add the below line in /etc/modprobe.d/ directory to load the bonding module in to kernel. File name can be anything with “.conf” extension.

# vim /etc/modprobe.d/bonding.conf 
alias bond0 bonding
options bond0 mode=balance-alb miimon=100

Step #4 Test Configuration and Restart Network Service

Run the following command to load the bonding module.

# modprobe bonding

Restart the network service now.

# service network restart

To check the status of linux kernel bonding driver, you need to execute below command.

# cat /proc/net/bonding/bond0

Step #5 Verify bond0 interface

Run the following command to verify whether “bond0” has come up with IP or not.

# ifconfig -a
bond0     Link encap:Ethernet  HWaddr 00:0C:30:80:18:FA  
          inet addr:192.168.5.30  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::62eb:69ff:fed2:d2a6/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:22 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3843 (3.7 KiB)  TX bytes:4169 (4.0 KiB)

eth2      Link encap:Ethernet  HWaddr 00:0C:30:80:18:FA  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2031 (1.9 KiB)  TX bytes:2064 (2.0 KiB)

eth3      Link encap:Ethernet  HWaddr 00:0C:30:80:18:FA  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1812 (1.7 KiB)  TX bytes:2105 (2.0 KiB)

Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.