8/25/2014

Configure Network Bonding in Ubuntu Server

Overview


Network bonding is the aggregation or combination of multiple lan cards into a single bonded interface to provide high availability and redundancy. Network bonding is  also known as NIC teaming.

In this article we will discuss how to configure network bonding in Ubuntu 14.04 LTS Server. In my scenario I have two Lan Cards : eth0 & eth1 and will create a bond interface bond0 with active-passive or active-backup mode.

Step:1 Install bonding Kernel module using below command


root@mail:~#  apt-get install ifenslave-2.6

Step:2 Load the kernel module.


Edit the file /etc/modules and add the bonding module at the end .

root@mail:~# vi /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
lp
rtc
bonding

Save & exit the file

Now load the module using modprobe command as shown below :

# sudo modprobe bonding

Step:3 Edit interface config file.


# sudo vi /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

#eth0 is manually configured, and slave to the bondo interface

auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0

#manually configured eth1 and second interface used in bonding(bond0)

auto eth1
iface eth1 inet manual
bond-master bond0

# bond0 is the bonding NIC and can be used like any other normal NIC.

# bond0 is configured using static network information.
auto bond0
iface bond0 inet static
address 192.168.1.151
gateway 192.168.1.1
netmask 255.255.255.0
dns-nameservers 4.2.2.2
bond-mode active-backup
bond-miimon 100
bond-slaves none

Step:4 Restart the networking service & see the bond interface status


root@mail:~# service networking restart

Verify the bond interface using below command :

# ip add

ip-add
We can also use ifconfig command to see the bond interface.

Now check the bond interface status using below command :

# cat /proc/net/bonding/bond0

verify-bond-interface

Note : To do the testing we can down one interface and access the server and see the bond status.

No comments: