Comments on NIC Bonding On Slackware 12.1

NIC Bonding On Slackware 12.1 I was standing in front of a problem while I built a NFS Storage Server. It is necessary for me to have redundancy in every point of view. I solved all redundancy issues I had by using server hardware with redundant power supplies, a Raid 1+ 0 Raid array and two UPS’s one for each power supply. The only thing left in my mind was what about a network failure? Well just use the two Gig NIC’s and hook each of them up to its own switch. Great idea but how do I get them acting as one unit speak one single IP? NIC Bonding was my solution. After a couple of hours researching on the Internet stumbled upon the build in solution by using ifenslave.

6 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Anonymous

     Ethernet bonding requires switch side configuration also in order to work as expected.

 

By: HN

Not entirely true.

You can provide the "mode=<n>" parameter to the bonding module.

For most of the modes, you do not need any switch config, however if you select LACP mode (from memory, i think LACP is supported by the bond module), the switch connected to the NIC's obviously needs to support LACP.

HN

By: Anonymous

 In order to make a "logical" interface to work properly, you need both sides (server,switch) to be configured accordingly. I dont say that there will be connectivity issues , but you WONT get twice the bw without "merging" the switch ports. 

By: SoftBear

Interesting point, assuming bandwidth was the goal, this would be true, and would require a switch that supports bonding. 

 However, the stated purpose of THIS thread was painless redundancy. 

 I believe that goal is achieved without concern for what happens beyond the bounds of the target system. 

By: AntiCMOS

Personally I think setting up anything other than LACP is foolish. If your going to bond a ether channel you might as well get the extra bandwidth with your redundancy.

By:

copy and paste to bond_setup.sh, sh ./bond_setup.sh

<code>

#!/bin/bash

# Quick and dirty script to setup bonding on Slackware-12.2
# 12/20/2008 Joey Trungale <[email protected]>

MODULE=e1000e
NIC0=eth1
NIC1=eth2

set -e

echo
echo "Compiling ifenslave..."
cd /usr/src/linux/Documentation/networking
gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave
strip ifenslave

echo "Installing ifenslave..."
cp ifenslave /sbin/ifenslave

echo "Creating rc.bond script..."
cd /etc/rc.d
touch rc.bond
chmod 755 rc.bond

cat <<EOF> rc.bond
#!/bin/sh

case "\$1" in
  'start')
    echo "start bond0"
    #modprobe bonding mode=balance-alb miimon=100
    modprobe bonding mode=balance-rr miimon=100
    modprobe $MODULE
    ifconfig bond0 up
    ifenslave bond0 $NIC0
    ifenslave bond0 $NIC1
    #TODO need to be changed
    #ifconfig bond0 hw ether 00:16:3e:aa:aa:aa
  ;;
  'stop')
    ifconfig bond0 down
    rmmod bonding
    rmmod $MODULE
  ;;
  *)
    echo "Usage: \$0 {start|stop}"
  ;;
esac
EOF

echo "Patching rc.M to start rc.bond on startup..."
patch -s -p0 rc.M <<EOF
--- rc.M    2008-12-20 08:37:48.000000000 -0600
+++ rc.M.new    2008-12-20 08:38:47.000000000 -0600
@@ -82,6 +82,11 @@
   fi
 fi
 
+# If script rc.bond is executable then start it
+if [ -x /etc/rc.d/rc.bond ]; then
+  . /etc/rc.d/rc.bond start
+fi
+
 # Initialize the networking hardware.
 if [ -x /etc/rc.d/rc.inet1 ]; then
   . /etc/rc.d/rc.inet1
EOF

cat <<EOF

Dont forget to add the following to /etc/rc.d/rc.inet1.conf:

IFNAME[4]="bond0"
IPADDR[4]="XXX.XX.XX.XX"
NETMASK[4]="255.255.255.0"
USE_DHCP[4]=""
DHCP_HOSTNAME[4]=""

Also, you may wish to choose a different method of bonding,
modify the 'mode=' option in rc.bond to one of the settings
from /usr/src/linux/Documentation/networking/bonding.txt.

Enjoy!
EOF
</code>