NIC Bonding : Bonding / Teaming Multiple Network Interfaces (NIC) Into a Single Interface

Bonding is nothing but Linux kernel feature that allows to club multiple like NICs (such as eth0, eth1) into a single virtual link such as bond0., which may increase the bandwidth and provides redundancy of NIC Cards. 
- redundant links
- fault tolerance or load balancing 

There are various types of Channel Bonding modes are available but mainly we will use two below :-

0: Load balancing (Round-Robin) : Traffic is transmitted in sequential order or round-robin fashion from both NIC. This mode provides load balancing and fault tolerance.

1: Active-Backup : Only one slave NIC is active at any given point of time. Other Interface Card will be active only if the active slave NIC fails.

Creating Ethernet Channel Bonding :-
We have two Network Ethernet Cards i.e eth1 and eth2 where bond0 will be created for bonding 


Configure eth1 and eth2 for bonding purpose :-


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

# vi /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE="eth1"
TYPE=Ethernet
ONBOOT="yes"
BOOTPROTO="none"
USERCTL=no
MASTER=bond0

SLAVE=yes

Create bond0 Configuration

# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.246.130
NETMASK=255.255.255.0

BONDING_OPTS="mode=0 miimon=100"

mode=0 => for Round Robin
mode=1 => for Active-Backup

Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. 
# vi /etc/modprobe.conf

Append below line:

alias bond0 bonding

Now restart network service and check bonding by ifconfig command
# service network restart
#ifconfig

bond0     Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
          inet addr:192.168.1.10  Bcast:192.168.246.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:17374 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16060 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1231555 (1.1 MiB)  TX bytes:1622391 (1.5 MiB)

eth1      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:16989 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8072 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1196931 (1.1 MiB)  TX bytes:819042 (799.8 KiB)
          Interrupt:19 Base address:0x2000

eth2      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:385 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7989 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:34624 (33.8 KiB)  TX bytes:803583 (784.7 KiB)
          Interrupt:19 Base address:0x2080

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

Checking the status of the bond.

for mode=0 load balancing (round-robin)

#cat /proc/net/bonding/bond0

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:c6:be:59
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:c6:be:63


for mode=1 , fault-tolerance (active-backup)

#cat /proc/net/bonding/bond0

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:0c:29:57:61:8e
Slave queue ID: 0

Slave Interface: eth2
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:0c:29:57:61:98
Slave queue ID: 0
Note: Manually down and up the Slave Inter

Now, manually do Down and Up of interface to check bonding is working or not.

That`s it , I hope we will make a good bonding too with each other :P

Cheers !!
AJ

Comments

Popular posts from this blog

HP-UX virtual Machine Cheat Sheet

How to run fdisk in non-interactive mode