User Tools

Site Tools


linux:linux-networking:redhat-bonding

Redhat Bonding

Red Hat Enterprise Linux allows administrators to bind multiple network interfaces together into a single channel using the bonding kernel module and a special network interface called a channel bonding interface. Channel bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy.

ifcfg-bond<N>

To create a channel bonding interface, create a file in the /etc/sysconfig/network-scripts/ directory called ifcfg-bond<N>, replacing <N> with the number for the interface, such as 0.

The contents of the file can be identical to whatever type of interface is getting bonded, such as an Ethernet interface. The only difference is that the DEVICE= directive must be bond<N>, replacing <N> with the number for the interface.

The following is a sample channel bonding configuration file:

DEVICE=bond0
BOOTPROTO=none 
ONBOOT=yes 
NETMASK=255.255.255.0 
IPADDR=10.0.1.27 
USERCTL=no
BONDING_OPTS="mode=1 miimon=100 primary=lan0"

ifcfg-eth<N>

After the channel bonding interface is created, the network interfaces to be bound together must be configured by adding the MASTER= and SLAVE= directives to their configuration files. The configuration files for each of the channel-bonded interfaces can be nearly identical.

For example, if eth0 and eth1 are being channel bonded, both would look like the following example;

DEVICE=eth<N> 
BOOTPROTO=none 
ONBOOT=yes 
MASTER=bond0 
SLAVE=yes 
USERCTL=no

In this example, replace <N> with the numerical value for the interface.

Kernel Module

For a channel bonding interface to be valid, the kernel module must be loaded. To ensure that the module is loaded when the channel bonding interface is brought up, add the following line to /etc/modprobe.conf:

alias bond<N> bonding

Replace <N> with the number of the interface, such as 0. For each configured channel bonding interface, there must be a corresponding entry in /etc/modprobe.conf.

options bond0 mode=1 miimon=100

mode: Specifies one of the bonding policies. The default is balance-rr (round robin)

mode type Description
mode=0 balance-rr Round-robin: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance
mode=1 active-backup One slave interface is active at any time. If one interface fails, another interface takes over the MAC address and becomes the active interface. Provides fault tolerance only. Doesn't require special switch support
mode=2 balance-xor Tranmissions are balanced across the slave interfaces based on (source MAC) XOR (dest MAC) modula slave count. The same slave is selected for each destination MAC. Provides load balancing and fault tolerance
mode=3 broadcast Transmits everything on all slave interfaces. Provides fault tolerance
mode=4 802.3ad This is classic IEEE 802.3ad Dynamic link aggregation. This requires 802.3ad support in the switch and driver support for retrieving the speed and duplex of each slave. Refer to you ethernet switches documentation too have more details
mode=5 balance-tlb Adaptive Transmit Load Balancing. Incoming traffic is received on the active slave only, outgoing traffic is distributed according to the current load on each slave. Doesn't require special switch support
mode=6 balance-alb Adaptive Load Balancing - provides both transmit load balancing (TLB) and receive load balancing for IPv4 via ARP negotiation. Doesn't require special switch support, but does require the ability to change the MAC address of a device while it is open

miimon

Specifies the MII link monitoring frequency in milliseconds. 
This determines how often the link state of each slave is inspected for link failures. 
A value of zero disables MII link monitoring. A value of 100 is a good starting point. 
The use_carrier option, below, affects how the link state is determined. 
See the High Availability section for additional information. The default value is 0.

PRIMARY Its used to slect a primary active nic on a Active/pasive team (mode=1)

Once /etc/modprobe.conf is configured and the channel bonding interface and network interfaces are configured the ifup command can be used to bring up the channel bonding interface.

Checking Status
cat /proc/net/bonding/bond

Documentation

Following documents are from the Redhat Knowledge base which has restricted access

Bonding for RHEL upto RHEL5

Bonding for RHEL 6

linux/linux-networking/redhat-bonding.txt · Last modified: by 127.0.0.1