Sunday, 29 January 2017

CONFIGURE NIC (NETWORK INTERFACE CARD) BONDING in RHEL 7

NIC (Network Interface Card) bonding is also known as Network bonding. It can be defined as the aggregation or combination of multiple NIC into a single bond interface. Its main purpose is to provide high availability and redundancy.

Policy Details
Ploicy Name
Code
Description
balance-rr
0
Round-Robin policy for fault tolerance
active-backup
1
Active-Backup policy for fault tolerance
balance-xor
2
Exclusive-OR policy for fault tolerance
broadcast
3
All transmissions are sent on all slave interfaces.
802.3ad
4
Dynamic link aggregation policy
balance-tlb
5
Transmit Load Balancing policy for fault tolerance
balance-alb
6
Active Load Balancing policy for fault tolerance

Prerequisite:

If bonding module is not loaded on your linux box then use the below command to load.

# modprobe bonding

To list the bonding module info, use following command.

# modinfo bonding
[root@localhost ~]# modinfo bonding
filename:       /lib/modules/3.10.0-229.el7.x86_64/kernel/drivers/net/bonding/bonding.ko
alias:          rtnl-link-bond
author:         Thomas Davis, tadavis@lbl.gov and many others
description:    Ethernet Channel Bonding Driver, v3.7.1
version:        3.7.1
license:        GPL
rhelversion:    7.1

create a file bonding.conf in /etc/modprobe.d/

[root@localhost ~]# vi /etc/modprobe.d/bonding.conf
alias bond0 bonding
[root@localhost ~]#

Create a bond interface file. In my case its bond0

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vi ifcfg-bond0
DEVICE=bond0
TYPE=Bond
NAME=bond0
BONDING_MASTER=yes
BOOTPROTO=none
ONBOOT=yes
IPADDR=x.x.x.x
NETMASK=x.x.x.x
GATEWAY=x.x.x.x
DNS1=x.x.x.x
BONDING_OPTS="mode=1 miimon=100"
[root@localhost network-scripts]#

Choose desired bond policy and make changes in BONDING_OPTS field. In my case I have chosen mode 1 which is active backup.

Configure the existing interfaces as slave to bond0

[root@localhost network-scripts]# cat ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
DEVICE=eth0
ONBOOT=yes
HWADDR="00:50:56:96:64:9d"
MASTER=bond0
SLAVE=yes
[root@localhost network-scripts]# cat ifcfg-eth1
TYPE=Ethernet
BOOTPROTO=none
DEVICE=eth1
ONBOOT=yes
HWADDR="00:50:56:96:18:a6"
MASTER=bond0
SLAVE=yes
[root@localhost network-scripts]# systemctl restart network
[root@localhost network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

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

Slave Interface: eth0
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:96:64:9d
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:96:18:a6
Slave queue ID: 0
[root@localhost ~]#


We have successfully configured nic bonding with Bonding Mode: fault-tolerance (active-backup)

No comments:

Post a Comment