Red Hat Channel Bonding

Use the procedures included in this section to implement channel bonding on Red Hat installations.

Channel bonding of LAN interfaces is implemented by the use of the bonding driver, which is installed in the kernel at boot time. With this driver installed, the networking software recognizes bonding definitions that are created in the /etc/sysconfig/network-scripts directory for each bond. For example, the file named ifcfg-bond0 defines bond0 as the master bonding unit, and the ifcfg-eth0 and ifcfg-eth1 scripts define each individual interface as a slave.

Bonding can be defined in different modes. Mode 0, which is used for load balancing, uses all slave devices within the bond in parallel for data transmission. This can be done when the LAN interface cards are connected to an Ethernet switch such as the HP {ProCurve} switch, with the ports on the switch configured as Fast {EtherChannel} trunks. Two switches should be cabled together as an HA grouping to allow package failover.

For high availability, in which one slave serves as a standby for the bond and the other slave transmits data, install the bonding module in mode 1. This is most appropriate for dedicated heartbeat connections that are cabled through redundant hubs that are cabled together.

Refer to the file, /usr/src/linux-2.N/Documentation/networking/bonding.txt, for additional networking information on bonding.

NOTE: It is recommended that you do the bonding configuration from the system console, because you will need to restart networking from the console when the configuration is done.

Sample Configuration

Configure the following files to support LAN redundancy. For a single failover only one bond is needed.

Create a bond0 file, ifcfg-bond0. Create the configuration in the /etc/sysconfig/network-scripts directory. For example, in the file, ifcfg-bond0, bond0 is defined as the master (for your installation, substitute the appropriate values for your network instead of 192.168.1).

Include the following information in the ifcfg-bond0 file:

DEVICE=bond0
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0 # optional
BROADCAST=192.168.1.255 # optional
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

Create an ifcfg-ethN file for each interface in the bond. All interfaces should have SLAVE and MASTER definitions.

DEVICE=ethN
HWADDR=nn:nn:nn:nn:nn:nn
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

To include ethtool options, edit the ifcfg-ethN file to appear as follows:

DEVICE=ethN
HWADDR=nn:nn:nn:nn:nn:nn
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
ETHTOOL_OPTS="speed 100 duplex full autoneg off" # for 100/full
ETHTOOL_OPTS="speed 1000 duplex full autoneg on" # for 1000/full

Add the following lines to /etc/modprobe.conf:

alias bond0 bonding
options bond0 miimon=100 mode=1

Use MASTER=bond1 for bond1 if you have configured a second bonding interface, add the following special instructions for the second bond, including the references to the first bond:alias bond0 bonding

options bond0 miimon=100 mode=1
options bond1 -o bonding1 miimon=100 mode=1

NOTE: During configuration, you need to make sure that the active slaves for the same bond on each node are connected the same hub. You can check on this by examining the file /proc/net/bondx/info on each node. This file will show the active slave for bond x.

Restarting Networking

Restart the networking subsystem. From the console of either node in the cluster, execute the following command:

/etc/rc.d/init.d/network restart

CAUTION: Do not attempt to restart the network from a remote system connection that travels through the network, as the network will go down before the command can complete. This will result in the network being left in a down state.

The command lists bringing up network statements.

If there was an error in any of the bonding configuration files, the network might not function properly. If this occurs, check each configuration file for errors, then try to restart the network again.

Viewing the Configuration

/sbin/ifconfig
cat /proc/net/bonding/bond0

Bonding modes

Number	Long Name	Description
mode=0	balance-rr	Round-robin policy: 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	Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.
mode=2	balance-xor	XOR policy: Transmit based on source MAC address XOR'd with destination MAC address slave count. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.
mode=3	broadcast	Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
mode=4	802.3ad	IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.
mode=5	balance-tlb	Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.
mode=6	balance-alb	Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.

Pre-requisites:

Mode 4:

Ethtool support in the base drivers for retrieving the speed and duplex of each slave.

A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode.

Mode 5:

Ethtool support in the base drivers for retrieving the speed of each slave.