Configure Network Bonding on CentOS 6 /RHEL 6

  
Network Bonding is the aggregation of multiple lan cards(eth0 & eth1) into a single interface called bond interface. Network Bonding is a kernel feature and also known as NIC teaming. Bonding is generally required to provide high availability and load balancing services.

In this tutorial we will configure network bonding on CentOS 6.X and RHEL 6.X , in my case i have two Lan Cards (eth0 & eth1) & will create bond interface (bond0).

Step:1 Create the bond file ( ifcfg-bond0 ) and specify the ip address,netmask & gateway

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

DEVICE=bond0IPADDR=192.168.1.9NETMASK=255.255.255.0GATEWAY=192.168.1.1TYPE=BondONBOOT=yesNM_CONTROLLED=noBOOTPROTO=static


Step:2 Edit the files of eth0 & eth1 and make sure you enter the master and slave entry, as shown below

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0HWADDR=08:00:27:5C:A8:8FTYPE=EthernetONBOOT=yesNM_CONTROLLED=noMASTER=bond0SLAVE=yes


# vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1TYPE=EthernetONBOOT=yesNM_CONTROLLED=noMASTER=bond0SLAVE=yes


Step:3 Create the Bond file(bonding.conf)

# vi /etc/modprobe.d/bonding.conf

alias bond0 bondingoptions bond0 mode=1 miimon=100


Different Modes used in bonding.conf file .

  • balance-rr or 0 — round-robin mode for fault tolerance and load balancing.
  • active-backup or 1 — Sets active-backup mode for fault tolerance.
  • balance-xor or 2 — Sets an XOR (exclusive-or) mode for fault tolerance and load balancing.
  • broadcast or 3 — Sets a broadcast mode for fault tolerance. All transmissions are sent on all slave interfaces.
  • 802.3ad or 4 — Sets an IEEE 802.3ad dynamic link aggregation mode. Creates aggregation groups that share the same speed & duplex settings.
  • balance-tlb or 5 — Sets a Transmit Load Balancing (TLB) mode for fault tolerance & load balancing.
  • balance-alb or 6 — Sets an Active Load Balancing (ALB) mode for fault tolerance & load balancing.


    Step:4 Now Restart the network Service

    # service network restart

    Using below command to Check the bond Interface

    root@localhost ~]# ifconfig bond0bond0 Link encap:Ethernet HWaddr 08:00:27:5C:A8:8Finet addr:192.168.1.9 Bcast:192.168.1.255 Mask:255.255.255.0inet6 addr: fe80::a00:27ff:fe5c:a88f/64 Scope:LinkUP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1RX packets:6164 errors:0 dropped:0 overruns:0 frame:0TX packets:1455 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0RX bytes:482336 (471.0 KiB) TX bytes:271221 (264.8 KiB


    Step:5 Verify the Status of bond interface.

    [root@localhost ~]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

    Bonding Mode: fault-tolerance (active-backup)Primary Slave: NoneCurrently Active Slave: eth0MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 0Down Delay (ms): 0

    Slave Interface: eth0MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 08:00:27:5c:a8:8fSlave queue ID: 0

    Slave Interface: eth1MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 08:00:27:7f:04:49Slave queue ID: 0

    Note: As per the output shown above , we are currently using active-backup bonding. To do the testing just disable one interface and check whether you are still accessing your machine using the bond ip.

  • Copyright © Windows knowledge All Rights Reserved