Jan 31, 2011

How To Team/Bond NICs in Ubuntu

I have really been slacking on blogging lately. I hope that hasn't turned you guys off to Bauer-Power. I have been busy with work and family stuff lately, so I haven't had a lot of time to sit down and write. I promise you though that I am not abandoning the blog, and I will keep posting as often as I can.

With that out of the way, lets jump right in. In this post I will tell you how to team two NICs (Network Interface Cards) using Ubuntu Linux. If you have ever done it in WIndows it is usually pretty easy. Especially if you use an HP server. In Linux, it is actually pretty easy too. You just need to install one extra little package, create a config file for your team and modify your /etc/network/interfaces file. Simple right?

Now for a little back story. The reason I am writing about this is I am setting up an Ubuntu Fog server at work for Windows imaging and software deployment. The server I am building it on has two NICs, so I want to team them for redundancy and throughput.

For NIC teaming, there are 7 modes we can use. Choose whatever suits your environment the best:

  • Mode 0 - Balanced Round Robin
  • Mode 1 - Active-Backup
  • Mode 2 - Balanced XOR
  • Mode 3 - Broadcast
  • Mode 4 - IEEE 802.3ad Dynamic Link Aggregation
  • Mode 5 - Balanced transmit Load balancing
  • Mode 6 - Balanced Adaptive Load balancing

For more information on what the different modes do for you, check out this link here: (Ubuntu Bonding)

If you visit the link above, you will see that I do the bonding slightly different. I prefer to do it using the method on the Fog Wiki. It just works best for me and my Fog server. As you will see below, I specified the MAC address of my bond to match that of eth0. I found that if I didn't do that, Fog wouldn't be able to upload images, and would give me an error saying, "Unable to connect to TFTPD Server". Here is how to do it the Fog way:

  • Install ifenslave

    sudo apt-get update && sudo apt-get install ifenslave

  • Create a file called bonding.conf in /etc/modprobe.d

    sudo touch /etc/modprobe.d/bonding.conf

  • Edit /etc/modprobe.d/bonding.conf

    sudo nano /etc/modprobe.d/bonding.conf

  • Enter the following information and saving the file

    alias bond0 bonding

    options bonding mode=0 miimon=100 downdelay=200 updelay=200

  • Find the MAC address of eth0 by running ifconfig
  • Edit /etc/network/interfaces

    sudo nano /etc/network/interfaces

  • Comment out your eth0 section by adding a # before everything.
  • Enter the following information replacing the network info to match your network, and the MAC address to match the MAC you found using ifconfig

    auto bond0
    iface bond0 inet static
    hwaddress ether 00:AA:BB:CC:DD:EE
    post-up ifenslave bond0 eth0 eth1

  • Save the file when you are done, and reboot

When your server comes back up make sure you still have good network connectivity, and take a look at ifconfig now. You will see your new bond0 interface and it will now have the same MAC address as eth0 and eth1.

As you can see above, I used mode 0 for my team. You can use whatever you want, for whatever suits your environment the best. You make the call!

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam