How to Set up Network Bonding on CentOS 5.x Tutorial

centosEver wonder what to do with those extra NIC’s in your CentOS server? Why not bond them to add that extra throughput or load balancing and fault tolerance.

What is Bonding and it’s Modes?

Bonding, the process in which multiple NIC’s are combined to function as one interface

Modes of bonding:

mode=0 (Balance-rr) – This mode provides load balancing and fault tolerance.
mode=1 (active-backup) – This mode provides fault tolerance.
mode=2 (balance-xor) – This mode provides load balancing and fault tolerance.
mode=3 (broadcast) – This mode provides fault tolerance.
mode=4 (802.3ad) – This mode provides load balancing and fault tolerance.
mode=5 (balance-tlb) – Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.
mode=6 (Balance-alb) – Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.

Read more….

Note: Always append extra configuration in case of a rollback.

Preliminary Note:

We will be using the CentOS 5.2 YUM server in this tutorial:

  • server1.example.co.za (IP 10.0.0.100): YUM Repo server Bond0

We need to increase the throughput of our local YUM repo so we’re bonding four of it’s six NIC’s

Configuring the bond

# cd /etc/sysconfig/network-scripts/
# vi ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
#Fake MAC address
HWADDR=00:00:01:00:01:00
NETWORK=10.0.0.0
NETMASK=255.255.0.0
IPADDR=10.0.0.100
USERCTL=no
# vi ifcfg-eth2
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
# vi ifcfg-eth3
DEVICE=eth3
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
# vi ifcfg-eth4
DEVICE=eth4
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
# vi ifcfg-eth5
DEVICE=eth5
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
# vi /etc/modprobe.conf

We’ll be using mode=6 (Balance-alb)

Append the following onto the end out your modprobe config file

alias bond0 bonding
options bond0 mode=6 miimon=100
# servive network restart