| Monday November 24th 2014

Feedburner

Subscribe by email:

We promise not to spam/sell you.


Search Amazon deals:

HOWTO: Setup Network Bonding


What is bonding?
Bonding is the same as port trunking. In the following I will use the word bonding because practically we will bond interfaces as one.

But still… what is bonding?bond0
Bonding allows you to aggregate multiple ports into a single group, effectively combining the bandwidth into a single connection. Bonding also allows you to create multi-gigabit pipes to transport traffic through the highest traffic areas of your network. For example, you can aggregate three megabits ports (1 mb each) into a three-megabits trunk port. That is equivalent with having one interface with three megabits speed.

Where should I use bonding?
You can use it wherever you need redundant links, fault tolerance or load balancing networks. It is the best way to have a high availability network segment. A very useful way to use bonding is to use it in connection with 802.1q VLAN support (your network equipment must have 802.1q protocol implemented).


The example below is for bonding 2 network interfaces to 1 IP address. Both network cards will then share IP address 10.0.0.10. This was performed on a Fedora 10 linux workstation. The file locations should transfer to RedHat Enterprise Linux (RHEL) and CentOS, but not Debian based distros (e.g., Ubuntu).

Create the file: /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
PEERDNS=no
IPV6INIT=no
NM_CONTROLLED=no
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=10.0.0.10
GATEWAY=10.0.0.1

Then, for each interface (network card) you want to bond to the bond0 interface, edit the respective device’s configuration file: /etc/sysconfig/network-scripts/ifcfg-[interface] (e.g., eth0, eth1, ra0)

DEVICE=[match to the interface you're mapping] (e.g., eth0, eth1, ra0)
MASTER=bond0
SLAVE=yes
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
PEERDNS=no
IPV6INIT=no
NM_CONTROLLED=no
TYPE=Ethernet

Then create and edit /etc/modprobe.conf (or modules.conf for RHEL) and add the following lines:

alias bond0 bonding
options bonding miimon=100 mode=1

I chose to use mode=1 which is “active backup mode.” mode=0 is “round-robin.” What does that mean? Definitions are below. (There are several “modes,” but these 4 are the most popular.)

mode=0 (balance-rr)
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.

mode=1 (active-backup)
Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond’s MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.

mode=3 (broadcast)
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.

mode=4 (802.3ad)
IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.

A service network restart is all that was needed to activate bond0. If not, a reboot will do it.

The best documentation is found on the Linux Channel Bonding Project page

Related Posts: On this day...

Reader Feedback

4 Responses to “HOWTO: Setup Network Bonding”

  1. tj says:

    Hi,
    Thanks for this great doc.
    How do I connect the slave interface eth0, eth1 to the LAN switch ? Both interfaces need to connect or just only one ? …

    If both eth0 and eth1 are connected, does the LAN switch select one higher priority than other ?

    Thanks
    TJ

  2. roman@wlan says:

    Does my mac adresse change if I upgrade my computer with some other hardware? For example change the graphic card?

  3. kado afscheid says:

    Hi there! Quick question that’s completely off topic. Do you know how to make your site mobile friendly? My weblog looks weird when viewing from my iphone. I’m trying to find a template or plugin that might be able to correct this problem. If you have any suggestions, please share. With thanks!

Leave a Reply

You must be logged in to post a comment.