Bonded network interfaces create resilient network connections and provide better throughput. You can create a bond from 2 NICs e.g. eth0 and eth1. They are effectively glued together to create a single logical interface thereby increasing throughput and if one interface fails, the IP address will automatically failover to the remaining interface giving better resilence. Here's how to create one.

1. Add the following line to /etc/modprobe.conf in RHEL 5.x or create a file called bonding.conf in /etc/modprobe.d for RHEL 6+ containing the following line (the bonding kernel module needs to be loaded for it to work)

 alias bond0 bonding 

2. Create a file in /etc/sysconfig/network-scripts called ifcfg-bond0, e.g.

 DEVICE=bond0
 BOOTPROTO=none
 ONBOOT=yes
 BONDING_OPTS="mode=1 miimon=100"
 IPADDR=192.168.1.10
 NETMASK=255.255.255.0

NOTE: BONDING_OPTS mean the following, mode=0 indicates loading balancing performed, mode=1 indicates active/passive, so failover mode. To use load balancing, both NICs (e,g, eth0 & eth1) would need to connect to the same network switch. For better HA it's better to connect to 2 different switches so mode=1 should be chosen. miimon=100 is the interval in milliseconds between when the interface is checked by the kernel for errors

3. Once the bonding interface has been created, the NICs must be bound together. In /etc/sysconfig/network-scripts configuration files for the NICs must be created, ifcfg-eth0 and ifcfg-eth1

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
ETHTOOL_OPTS="speed 1000 duplex full autoneg on"

DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
ETHTOOL_OPTS="speed 1000 duplex full autoneg on"

These indicate the following:

  1. DEVICE: Indicates what is the NIC device name
  2. USERCTL: Indicates that can user control this device(here its no)
  3. ONBOOT: Indicates that at the boot time do this device should be up?
  4. MASTER: Does this device have a master? If so, what it is(here its bond0)
  5. SLAVE: Is this device acting as slave? In this case it is of bond0
  6. BOOTPROTO: What about getting IP Address from DHCP? ItÂ’s set to none which indicate it uses a static IP as set in ifcfg-bond0

4. Restart the network service (or reboot)

service network restart 

or (RHEL 7+)

systemctl restart network.service

Recent Changes

Contribute to this wiki

Why not help others by sharing your knowledge? Contribute something to this wiki and join out hall of fame!
Contact us for a user name and password