Tuesday, February 17, 2009

ItFixed it for me - Nic Bonding on Linux to Double Network Throughput

This article will hopefully help someone using a Linux server with dual network cards.
I have an HP DL380 server that on a nightly basis copies large amounts of data across my network to a backup server. The copy was averaging over 8 hours to complete.

To increase my network throughput I was able to install and configure a second network card and then team (bond) them together to essentially get double the throughput.

For those that want to give this a try I will post the steps below. As always I do not guarantee that this will work for you but ITFixed it for me.

Before you begin take a backup copy of the following files in case you have to set them back to a working state.

/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1
/etc/modules.conf

I have this working on two Redhat Enterprise linux servers (one RHEL3 and the other RHEL4). But I would imagine that this should work on many other Linux distributions as well.

Create a new file
/etc/sysconfig/network-scripts/ifcfg-bond0 and add the following to it, using your own ip addresses
DEVICE=bond0
IPADDR=x.x.x.x
NETWORK=y.y.y.y
NETMASK=z.z.z.z
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
Modify your /etc/sysconfig/network-scripts/ifcfg-eth0 file and change it to
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
Also modify your /etc/sysconfig/network-scripts/ifcfg-eth1 file and change it to
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
Save all of these files.
Add the following lines to the end of /etc/modules.conf
alias bond0 bonding
options bond0 mode=balance-alb miimon=100

Make sure the bonding module is loaded with
modprobe bonding
Then restart the network service

service network resart
You should now see the bond0 nic listed if you run and ifconfig from the command line.

Make sure you backup the files before you make any changes and I also recommend to to this while you have direct access to the server as it will disconnect your network connection temporarily if you are connecting to the server remotely (over ssh or vnc etc...) If you have direct access to the server you can set your files back to the originals if something goes wrong.

Good Luck.






2 comments:

ThinMe_TL said...

Question - How do you check a network card throughput?
How can you check that network throughput has increased?

Thanks

Scott Mckeown said...

I used a util called iptraf.
You should be able to get it with yum or up2date.

Scott