Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
LinuxEthernetBonding
Edit
PageHistory
Diff
Info
LikePages
!!What is Ethernet Bonding Ethernet bonding refers to aggregating multiple ethernet channels together to form a single channel. This is primarily used for redundancy in ethernet paths or for load balancing. This page refers in particular to performing ethernet bonding under linux, and so does not limit itself to discussion of 802.3ad Trunk Aggregation. !!Bonding Types The linux kernel bonding module supports a number of bonding types. * Round Robin ** Packets are transmitted in a round robin fashion over the available slave interfaces. Provides both load balancing and fault tolerance * Active Backup ** One slave interface is active at any time. If one interface fails, another interface takes over the MAC address and becomes the active interface. Provides fault tolerance only. Doesn't require special switch support * Balance XOR ** Tranmissions are balanced across the slave interfaces based on ((source MAC) XOR (dest MAC)) modula slave count. The same slave is selected for each destination MAC. Provides load balancing and fault tolerance. * Broadcast ** Transmits everything on all slave interfaces. Provides fault tolerance. * 802.3ad ** This is classic IEEE 802.3ad Dynamic link aggregation. This requires 802.3ad support in the switch and driver support for retrieving the speed and duplex of each slave. * Balance TLB ** Adaptive Transmit Load Balancing. Incoming traffic is received on the active slave only, outgoing traffic is distributed according to the current load on each slave. Doesn't require special switch support * Balance ALB ** Adaptive Load Balancing - provides both transmit load balancing (TLB) and receive load balancing for IPv4 via ARP negotiation. Doesn't require special switch support, but does require the ability to change the MAC address of a device while it is open !!Tools You need the bonding module for your kernel, and the ifenslave tool which is found within the kernel source at Documentation/networking/ifenslave.c, or you could use a distribution provided package (eg, apt-get install ifenslave-2.4 or apt-get install ifenslave-2.6 depending on your kernel version). ! Module alias It is recommended that you let the kernel know which module to use for the bonded interface by setting the following in the appropriate place for module options (for debian it is /etc/modutils/aliases): <verbatim> alias bond0 bonding </verbatim> ! Module options When loading the bonding module, you must specify the mode you wish to use. It's normally best to set this as a modprobe option, the location of which will depend on your distribution. For debian, you could set it in /etc/modutils/options and run update-modules Read the kernel docs for which options are supported. At a minimum, you have to set the bonding mode you wish to use, eg: <verbatim> options bond0 mode=802.3ad miimon=100 </verbatim> ! Creating the bonded interface To bond eth0 and eth1 into the bonded device bond0, and assign this device the IP address 192.168.1.1 within the 192.168.1.0/24 network, do the following: <verbatim> ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up ifenslave bond0 eth0 ifenslave bond0 eth1 </verbatim> During a setup I did recently (February 2006) using active-backup, I had to change the MAC address of the interface that was ifenslaved second to be the same as the first. It seemed that something weird was happening like the second interface would answer an ARP request for an IP address, and provide the MAC address of the bridge, but the machine never got packets, because it wouldn't accept packets for anything other than the MAC of the second interface. I didn't investigate further, it could have been something I was doing wrong. -- MichaelJager (IsomerMadeMeDoThis) Your distribution will possibly have native interface control support for creating bonded interfaces. Check your manual pages. RedHat and SuSE (and derivatives) have native support; debian doesn't appear to. An example of how to do this within debian is as follows: <verbatim> auto eth0 eth1 bond0 iface eth0 inet manual iface eth1 inet manual iface bond0 inet static pre-up ifconfig bond0 up pre-up ifenslave bond0 eth0 eth1 pre-down ifenslave -d bond0 eth0 eth1 address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254 </verbatim> There is a mailing list post which contains some hook scripts for debian to provide ifupdown bonded interface functionality. These can be found [here|http://lists.debian.org/debian-mentors/2005/10/msg00213.html] !!VLANs You can specify VLAN interfaces on top of a bonded interface. Simply assign the bond0 interface no IP address (or 0.0.0.0), and then you can use the bond0 interface as the physical device for the VLAN interface. Refer to your distribution documentation on how to setup vlans within your network configuration. I've done this, and it works well. I wanted to use bridging at let STP work out which interface to put into forwarding, and which to put into blocking, but the bridging driver didn't work with per-VLAN spanning tree; as a result I ended up using bonding in active-backup mode. -- MichaelJager !!References * Linux kernel documentation, Documentation/networking/bonding.txt * http://www.debian-administration.org/articles/312
3 pages link to
LinuxEthernetBonding
:
NICFaultTolerance
802.3ad
802