Topics: Networking, Red Hat / Linux

Enabling bonding in Linux

To enable "etherchannel" or "bonding" in Linux nomenclature:

  • Add these two lines to /etc/modprobe.conf:
    alias bond0 bonding
    options bond0 miimon=100 mode=1 primary=eth0
    Entry "mode=1" simply means active/standby. Entry "miimon" is the number in milliseconds to wait before determining a link dead (Change eth0 to match your primary device, if it is different. Blades sometimes have eth4 as the primary device).
  • In /etc/sysconfig/network-scripts create ifcfg-bond0 with the following (of course, change the network info to match your own):
    DEVICE=bond0
    BROADCAST=10.250.19.255
    IPADDR=10.250.19.194
    NETMASK=255.255.255.0
    GATEWAY=10.250.19.1
    ONBOOT=yes
    BOOTPROTO=none
  • Change ifcfg-eth0 and ifcfg-eth1 (or whatever they are) to resemble this:
    DEVICE=eth0
    HWADDR=00:22:64:9B:54:9C
    USERCTL=no
    ONBOOT=yes
    MASTER=bond0
    SLAVE=yes
    BOOTPPROTO=none
    Leave the value of HWADDR to whatever it is in your file. This is important. It is this devices MAC Address.
  • Run /etc/init.d/network restart. You will want to do at least this part from the console, in case something goes wrong.
  • Once you get your "OK" and the prompt comes back, do an ifconfig -a. You should see bond0.
  • Make sure you can ping your default gateway. After that, all should be good.
Note: When making back up copies of the ifcfg-* files, you must either move the backup files out of this directory or change your backup copy strategy for these files. The primary network script that reads these files, basically runs: ls ifcg-*. It then creates an interface based on the part after the dash ("-"). So if you run, for example:
# cp ifcfg-eth0 ifcfg-eth0.bak
You will end up with an alias device of eth0 called eth0.bak. Instead do this:
# cp ifcfg-eth0 bak.$(date +%Y%m%d).ifcfg-eth0
That foils the configuration script and allows to keep backup/backout copies in the same directory with the working copies.



If you found this useful, here's more on the same topic(s) in our blog:


UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.

Interested in learning more?