Network

Network Card Bonding On Red Hat Linux and CentOS

Channel bonding combines multiple network interface cards to increase bandwidth, provide interface failover or load balancing, or use 802.3ad port trunking. It also supports VLANs, or 802.1q. Bonding interface modes

  1. mode=0 round-robin policy sends and receives data sequentially across LAN ports. This mode provides fault tolerance and load balancing.
  2. mode=1 (active-backup) uses an active interface and a backup. The master interface operates normally while the slave is idle. If the master fails, the slave takes over. This mode provides fault tolerance.
  3. mode=2 (balance-xor) uses an XOR policy, which is not covered here. This mode provides fault tolerance and load balancing.
  4. mode=3 (broadcast) transmits data on every slave interface. This mode provides fault tolerance.
  5. mode=4 (802.3ad) uses IEEE 802.3ad Dynamic link aggregation, also called link aggregation or port trunking. It requires a switch configured for 802.3ad. It also requires ethtool support in the driver to retrieve the speed and duplex of every slave port.
  6. mode=5 (balance-tlb, or Adaptive transmit load balancing) distributes outgoing traffic across slave interfaces, but receives traffic on the active slave. If the receiving slave fails, another slave takes over its MAC address. This mode provides fault tolerance and load balancing. It requires Ethtool support for checking each slave interface’s speed.
  7. mode=6 (balance-alb, or Adaptive load balancing) balances both incoming and outgoing IPv4 traffic. Receive load balancing intercepts outgoing ARP replies and replaces the MAC address with that of one slave interface. This mode provides fault tolerance and load balancing.

miimon specifies how often links are checked to ensure NIC links remain active, in milliseconds. Before using this option, check whether the NIC supports MII tool with:

ethtool  | grep "Link detected:"

Example configuration for balance-tlb, or mode 5 Edit /etc/modprobe.conf and add:

alias bond0 bonding
options bond0 miimon=80 mode=5

Run insmod to add the module.

insmod bond0 miimon=80 mode=5

Create ifcfg-bond0 in /etc/sysconfig/network-scripts/ by copying the following configuration and adjusting the IP address, netmask, and other settings as needed.

DEVICE=bond0
IPADDR=
NETMASK=
NETWORK=
BROADCAST=
GATEWAY=
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

Edit ifcfg-eth0 in /etc/sysconfig/network-scripts/.

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes

Edit ifcfg-eth1 in /etc/sysconfig/network-scripts/.

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
EOF.← Back to articles