Linux Administrator

How to Create NIC Bonding on CentOS 6 and RHEL 6

nic-bonding
mm
Written by Santosh Prasad

Bonding is nothing but Linux kernel feature that allows to aggregate multiple link interfaces (such as eth0, eth1) into a single virtual link such as bond0. The idea is pretty simple get higher data rates and as well as link failover.

Red Hat described bonding in documents as, Linux allows administrators to bind multiple network interfaces together into a single channel using the bonding kernel module and a special network interface called a channel bonding interface. Channel bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy.

If one physical NIC is down or unplugged, it will automatically move resource to other NIC card. Channel bonding will work with the help of bonding driver in kernel.

In this article I will show how to create NIC on CentOS/RHEL 6.

Create NIC Bonding on CentOS/RHEL 6

Follow the below steps to create NIC bonding on CentOS/RHEL 6.

1. Create a Bond Configuration File

First of all you need to create bond configuration file in /etc/sysconfig/network-scripts/ directory.

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

Add the below lines:

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

2. Modify Network Configuration Files

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

For eth1

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

For eth2

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

3. Creating Bonding Channel

Next, 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

4. Load the Bonding Module

Run the below command to to load the bonding module.

# modprobe bonding

5. Restart Network Service

Run the below command to restart the network service.

# service network restart

Check the status of Linux kernel bonding driver, you need to execute below command.

# cat /proc/net/bonding/bond0

6. Verify bond0 interface

Run the below command to verify bond0 interface.

# ifconfig -act

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)

eth1      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)

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: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)
Thank you! for visiting Look Linux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment