(14.Jul.2011)


In Linux it is extremely simple to merge/combine 2 different network cards (NICs) to achieve a higher throughput and/or have a backup in case that one fails.
The NICs can be connected directly to another PC or to a switch - keep in mind that of course if you're sending data to only 1 target PC it won't run any faster if it does not use the same setup (bottleneck).
Here are my notes. I am using "Gentoo" - the steps might be slightly different if you're using another distribution.


Steps

  • Make sure that in the kernel you selected under "Device Drivers ---] Networking support ---]" the option "[M] Bonding driver support". You might need the other options too (I did not check if they were really required) as mentioned here:

Device Drivers  ---]  Networking support  ---]   Networking options  ---]  
QoS and/or fair queueing  ---]   [*] QoS and/or fair queueing  
Device Drivers  ---]  Networking support  ---]
[M]   Bonding driver support
[M]   EQL (serial line load balancing) support

  • Edit "nano /etc/conf.d/modules" (in the new baselayout 2.x - different if using baselayout 1.x) and add at the very end the following (if you don't have already a section for the "bonding" module):

modules_2_6="${modules_2_6} bonding"
module_bonding_args_2_6="mode=0 miimon=100"

Read "/usr/src/linux/Documentation/networking/bonding.txt" to know which value for the above "mode" setting your should choose.

  • Once the kernel is ready, emerge (install) "ifenslave".
  • Create with "ln -s /etc/init.d/net.lo /etc/init.d/net.bond0" the symlink for your new network interface.
  • If you're not using DHCP edit your "/etc/conf.d/net" and add a section for your new interface giving it a brand new IP address:

config_bond0=( "10.0.12.1 netmask [same as your old entries]")
routes_bond0=( "default gw [same as your old entries]")

  • Make sure by e.g. running "rc-update" and/or adding "RC_PLUG_SERVICES="!net.*"" to "/etc/conf.d/rc" that no network interface is configured to start automatically during boot (no ethX, no bond0 yet).
  • Reboot
  • Once the system has rebooted check with "ifconfig" that the only interface you see is "lo".
  • Run the command "/etc/init.d/net.bond0 start" to start the bonded NIC.
  • Run the command "ifenslave bond0 [1st NIC] [2nd NIC]" (so, e.g. "ifenslave bond0 eth0 eth1") to assign your NICs to bond0.
  • Done. Now when you transfer data to/from that PC you should see that both network cards are being used (ok - depends on the "mode" that you chose above).

References