Linux Network Bonding or Trunking on CentOS 5.x


Network Bonding or Trunking refers to the aggregation of multiple network ports into a single aggregated group, effectively aggregating the bandwidth of multiple interfaces into a single connection pipe. Bonding is used to provide network load balancing and fault tolerance

We are assuming that you are using CentOS 5.x

Step 1: Create a bond0 config file at /etc/sysconfig/network-scripts/ directory

# touch /etc/sysconfig/network-scripts/ifcfg-bond0
# vim  /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.10.1
NETWORK=192.168.10.0
NETMASK=255.255.255.0
USERCTL=no

(Where IP is the Actual Address of the Bonded IP Address shared by the 2 physical NIC)

Step 2: Edit the configuration files of the 2 physical Network Cards (eth0 & eth1) that you wish to bond

# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
# vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no

Step 3: Load the Bond Module

/etc/modprobe.conf
alias bond0 bonding
options bond0 mode=0 miimon=100

Note:

  1. RHEL bonding supports 7 possible “modes” for bonded interfaces. See  Linux Bonding Modes website for more details on the modes.
  2. miimonspecifies (in milliseconds) how often MII link monitoring occurs. This is useful if high availability is required because MII is used to verify that the NIC is active.


Step 4:
Load the bond driver module from the command prompt.

modprobe bonding

Step 5: Restart the network

Restart the network

Step 6: Verify the /proc setting.

less /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.2.4 (January 28, 2008)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xx

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: yy:yy:yy:yy:yy:yy

Step 7: Final Tests

  1. Do a ifconfig to check everything is alright.
  2. ping from remote station to bond0 ipaddress
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s