Thursday, January 22, 2009

Setting Up Dual-Dual NIC Bonding On Ubuntu In 30 Seconds

Howdy,

Today we're going to cruise at maximum velocity, assuming that everything's fine (which it probably isn't) and plow through setting up bonding on a quad port nic card on Ubuntu in 30 seconds or less. Of course, it will probably take you longer than 30 seconds to read this post, but the people who publish books like "Linux in 5 Minutes" and "3 minute Abs" are pushing guys like me into a corner. The expectation of today's society is that everything in life should follow theory (If it "can" be done, it can be done ;) and, also, that it's very important to get things done as quickly as possible, especially if it involves dealing with people halfway across the globe from you. Of course, these expectations become more unrealistic by the minute (tick, tock) and most folks' innate need to feel like they "belong" (to what, I won't presuppose ;) keeps this bullet-train hurtling forward at ever-faster speed.

I predict that, in the future, everyone will need to see a psychiatrist daily and swallow approximately 50 mg of Valium, minimum, every 4 hours, in order to keep the heart-palpitations and nervous sweats from killing them either figuratively (as the "New World Office" eats the weak alive) or literally, since children will eventually be born with the irrational fear that they're not accomplishing as much as they should be, and most 12 year old's will be working on their 7th or 8th nervous-breakdown if they're lucky (?) enough to still be alive, in which case they can look forward to their early 20's, by which time they'll probably have worked themselves up to a nice quadruple bypass.

Now, crank the clock back about 60 years. Just 60 years. I have no point here. Just wondering: What's the rush?

The modern workplace always reminds me of a line from the film of Stephen King's "The Shawshank Redemption" - For a point of reference, the narration is that of a prison lifer who's just gotten released on parole in his golden years:

I saw an automobile once when I was young. Now they're everywhere. The world went and got itself in a big damn hurry.


Enough said. Here's a quick rundown of how to setup dual-dual bonding (two bonds of two interfaces each) on Ubuntu as quickly as possible. I wish I could spend more time with you today, but I've got s### to do ;)

The specific instructions which may or may not work for you (If they don't, don't worry, because you can't worry enough ;)

1. Add two lines to /etc/modules

bonding bond0 -o bond0 mode=1 miimon=100
bonding bond1 -o bond1 mode=1 miimon=100


If you're very good at managing your time, just remember that miimon's option determines how often the bond is monitored for failure and that mode can be one of:

0 - Round robin balancing
1 - Active back-up
2 - Transmit based on MAC address for load balancing/fault tolerance
3 - Broadcasting - provides fault tolerance by transmitting on all slave interfaces
4 - Aggregates links, assuming all nics support same speeds and duplex settings
5 - Transmit load balancing - balancing is handled by the bond based on load
6 - Same as 5, but also uses arp to balance load "better"

2. Install the ifenslave package if you haven't already. You can use apt-get to grab it if you don't:

host # apt-get install ifenslave-x.x

3. Ensure that the package actually installed:

# dpkg --get-selections | grep enslave
ifenslave-x.x install


4. Set up your interface files:

host # cat /etc/network/interfaces (only including the parts you probably need - substitute IP addresses, netmasks, etc):

auto lo
iface lo inet loopback

auto bond0
iface bond0 inet static
address 10.10.125.88
netmask 255.255.255.0
network 10.10.125.0
gateway 10.10.125.1
post-up ifenslave bond0 eth0 eth2
pre-down ifenslave -d bond0 eth0 eth2

auto bond1
iface bond1 inet static
address 10.10.127.88
netmask 255.255.255.0
network 10.10.127.0
gateway 10.10.127.1
post-up ifenslave bond1 eth1 eth3
pre-down ifenslave -d bond1 eth1 eth3


5. Add lines to the bottom of your architecture's modprobe files, reboot and pray:

host # cat /etc/modprobe.d/arch/i386

alias bond0 bonding
options bond0 mode=1 miimon=5000 max_bonds=2

alias bond1 bonding
options bond1 mode=1 miimon=5000 max_bonds=2


Congratulations, you're all set. Now get back to work ;)

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Excellent Web Hosting At An Affordable Price!
www.authorswebhosting.com
These Are The Guys I Use To Host My Online Presence!