+91 9619904949

The most important requirements of networking are availability and bandwidth for connectivity of LAN/WAN/INTERNET.
The current Linux distributions allow administrators to combine multiple (two or more) network interfaces together into a single logical interface called a bonding interface. In this process, both physical interfaces become slave devices and created a logical device (bond X) called a master device.

The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical “bonded” interface. The Linux bonding driver integrates as a loadable kernel module with all the distributions, and usually, it is loaded automatically when the Linux system is booting.

For network bonding, “ifenslave” is a control utility. By default, it is installed as module “/sbin/ifenslave”.

Make sure the kernel bonding module is enabled and loaded before go-ahead.

# modinfo bonding

If the above command throws an error like “modinfo: ERROR: Module alias bonding not found” then run modprobe –first-time bonding.

# modprobe –first-time bonding && modinfo bonding && modinfo bonding

Now create bonding channel interface using “/etc/modprobe.conf” or /etc/modprobe.d/bonding.conf and add following lines to the file.

# vim /etc/modprobe.conf
alias bond0 bonding

Linux kernel driver provides options to admin configure master bonding device with different modes and options are as per below.

Mode 0 or balance-RR:- Sets a round-robin policy for fault tolerance and load balancing.

Mode 1 or active-backup:- Sets an active-backup policy for fault tolerance.

Mode 2 or balance-xor:- Sets an XOR (exclusive-or) mode for fault tolerance and load balancing.

Mode 3 or broadcast:- Sets a broadcast policy for fault tolerance. All transmissions send on all slave interfaces.

Mode 4 or 802.3ad: Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings.

Mode 5 or balance-TLB:- To set a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic distributes according to the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave. This mode is only suitable for local addresses known to the kernel bonding module and therefore cannot be used behind a bridge with virtual machines.

Mode 6 or balance-alb:- Sets an Adaptive Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for IPv4 traffic.

Step for creating a Network bonding interface.

Create ifcfg-bond0 file into /etc/sysconfig/network-scripts/ directory for logical interface configration. Ifcfg-bond0 file handel IP configration which we set for network high avebility, and other bonding options.

# vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond1
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
BONDING_OPTS=”mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1″
IPADDR=192.168.0.11
NETMASK=255.255.255.0
GATEWAY=192.168.0.254

In the BONDING_OPTS

Miimon=time_in_milliseconds: shows(in milliseconds) how often link status is checked for link failure. This is useful if high availability is required because MII is used to verify that the NIC is active.
Arp_interval=time_in_milliseconds: Specifies (in milliseconds) how often ARP monitoring occurs. If using this setting while in mode 0 or mode 2 (the two load-balancing modes), the network switch must be configured to distribute packets evenly across the NICs.

Downdelay=time_in_milliseconds:- To wait before disabling a slave after a link failure has been detected.
updelay=time_in_milliseconds:- To wait before enabling a slave after a link recovery has been detected.
Lacp_rate=1(or fast) or 0 (slow): Option specifying the rate at which we’ll ask our link partner to transmit LACPDU packets in 802.3ad mode.
Xmit_hash_policy=1: Selects to transmit hash policy to use for slave selection in balance-xor, 802.3ad, and TLB modes.

# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HWADDR=00:25:90:1f:2c:e1
SLAVE=yes
MASTER=bond0
USERCTL=no

# vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
HWADDR=00:25:90:1f:2c:e2
SLAVE=yes
MASTER=bond1
USERCTL=no

To active bonding configuration, run the following command and check the status using cat /proc/net/bonding/bond0.

# nmcli con reload or service network restart

We can create multiple logical bonding bondX in the Linux system for different networks. For brief information about network bonding, follow “https://www.kernel.org/doc/Documentation/networking/bonding.txt.