NIC Bonding

If you have 2 NICs then you will probably want them to work side by side as one. This will allow double the throughput and also, if one goes down, the other can retain network connectivity. Bonding is also known as Teaming

Under CentOS, this is done by the following steps.

Create this file: /etc/sysconfig/network-scripts/ifcfg-bond0

Add the following details:

DEVICE=bond0
IPADDR=192.168.1.xxx
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
GATEWAY=192.168.1.1
ONBOOT=yes
BOOTPROTO=static
USERCTL=no
TYPE=Ethernet

You can also use DHCP there if you like by changing BOOTPROTO=dhcp and removing the lines containing IPs

Edit /etc/sysconfig/network-scripts/ifcfg-eth0

It should read:

DEVICE=eth0
USERCTL=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet

This will make it a slave of bond0 and read the ip details from it.

edit /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
USERCTL=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet

If you are having trouble with auto-negotiation of link (ie. it connects with half duplex) you can add the following to your eth0 and eth1 files: ETHTOOL_OPTS=”speed 100 duplex full autoneg off”

Now you need to edit /etc/modprobe.conf and append the following lines:

alias bond0 bonding
options bond0 mode=1 miimon=100

mode=1 means active backup. This leaves eth0 connected and transmitting data. Eth1 will be left dorment and will automatically become active when the eth0 fails (cable unplugged or switch failure, etc).
Finally, you can type
# modprobe mode=1 miimon=100
# service network restart
OR
reboot your system.

Your NICs should now be bonded and ready for use.
NOTE. the system may take a minute to come back up depending on your network.