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.
# 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.
# service networking restart
Verify the bond interface using below command:
# 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
Note: To do the testing we can down one interface and access the server and see the bond status.
Different Modes Used in Network Bonding are listed below:
- 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.