A few days after the first time I created a network bonding device in Linux, I had to create two network bonding on the same machine.
Sounds simple, but it seems that be default you can create only one device. As I tried to figure how to create two devices, I had a chance to investigate a bit on the issue of network bonding.
While the setting in /etc/sysconfig/network-scripts are quite simple and straight forward (see the RHEL References guide – Channel Bonding Interfaces), the settings in /etc/modules.conf hold some options to choose from.
First, we need to have a line the says that the device is a bonding device, so the the bonding module will manage it:
alias bondX bonding
Most how-to also sugget to add the following line:
options bond0 mode=0 miimon=100 or
options bond0 mode=1 miimon=100
But the mode parameter has a meaning that the system administrator should choose:
- Mode 0 or balance-rr is the Round-robin policy which gives fault tolerance and load balancing. This mode sends are receives package on each node in a sequential order. So the load is distributed on all NICs.
- Mode 1 or active-backup which gives only fault tolerance without load balancing. This modes sends all packets through the one active slave. The slave changes only if the active slave fails.
Other, more advanced modes are documented in the Kernel documentation at Documentation/networking/bonding.txt and the RHEL References guide – bonding Module Directives.
Returning to my original issue – creating two network boding devices. By default the bonding module let you create only one bonding device, adding the line
options bonding max_bonds=2 to /etc/modules.conf lets you (after reloading the driver) to make two bonding devices.
Notice that this time the options are for the bond module and not for a specific alias of the module.
RHEL5, lets you change the bonding options in the bond config file (e.g. /etc/sysconfig/network-scripts/ifcfg-bondo), with the BONDING_OPTS variable:
On RHEL4, you can achive the same goal with these settings in /etc/modules.conf:
alias bond0 bonding
options bond0 -o bond0 mode=1 miimon=100
alias bond1 bonding
options bond1 -o bond1 mode=0 miimon=50
as it causes the bonding module to be loaded twice and alias each one of the differently.
On RHEL machines you’ll need the iputils packages, which has /sbin/ifenslave to add the slaves to the bond when the are configured.