Ethernet Bonding allows two (or more) ethernet cards to act as one, dramatically increasing throughput or allowing for redundancy. More info about the various modes are available here.
1. Install ifenslave:
root# aptitude install ifenslave
2. Set the 'bonding' module to load at boot:
root# echo bonding >> /etc/modules
3. Set up your bonding configuration:
root# vim /etc/modprobe.d/bonding.conf
and put in these lines and save the file:
alias bond0 bonding
options bonding mode=5 miimon=100 downdelay=200 updelay=200
4. Edit your networking interfaces file
root# vim /etc/networking/interfaces
comment out the eth0 and eth1 settings, and set up bond0 (and bond1 if you have enough cards to do this), editing this info to match your needs:
iface bond0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1
up /sbin/ifenslave bond0 eth0 eth1
down /sbin/ifenslave -d bond0 eth0 eth1
5. If you have more than one bond (say, bond1 with eth2 and eth3) you'll need to set that up in your bootup scripts; edit /etc/init.d/networking and add* these lines (the bold ones) just before the Options are loaded:
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: networking
# Required-Start: mountkernfs $local_fs
# Required-Stop: $local_fs
# Should-Start: ifupdown
# Should-Stop: ifupdown
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Raise network interfaces.
### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
[ -x /sbin/ifup ] || exit 0
. /lib/lsb/init-functions
echo +bond1 >> /sys/class/net/bonding_masters
ifup bond1
process_options() {
[ -e /etc/network/options ] || return 0
log_warning_msg "/etc/network/options still exists and it will be IGNORED! Read README.Debian of netbase."
}
...
...
...
* I'm sure that this isn't the best place to add these lines for the bond1 but doing this in rc.local means your network comes up later than you maybe want. However, if you don't somehow add bond1 to that file, you'll get errors such as:
SIOCSIFADDR: No such device
bond1: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
0 comments:
Post a Comment