leafleafDocy banner shape 01Docy banner shape 02Flower illustration
Other

What is Network Bonding? Types of Network Bonding

Network bonding is a process of combing or joining two or more network interfaces together into a single interface. Network bonding offers performance improvements and redundancy by increasing the network throughput and bandwidth. If one interface is down or unplugged the other one will work. It can be used in situations where you need fault tolerance, redundancy or load balancing networks. In Linux, a special kernel module named bonding is used to connect multiple network interfaces into a single interface. Two or more network interfaces can be connected into a single logical ‘bonded’ interface. The behavior of the bonded interfaces depends on the type of bonding method used.

MRTG graph after establishing bonding

Types of Network Bonding

mode=0 (balance-rr)

This mode is based on Round-robin policy and it is the default mode. This mode offers fault tolerance and load balancing features. It transmits the packets in Round robin fashion that is from the first available slave through the last.

mode-1 (active-backup)

This mode is based on Active-backup policy. Only one slave is active in this band, and another one will act only when the other fails. The MAC address of this bond is available only on the network adapter part to avoid confusing the switch. This mode also provides fault tolerance.

mode=2 (balance-xor)

This mode sets an XOR (exclusive or) mode that is the source MAC address is XOR’d with destination MAC address for providing load balancing and fault tolerance. Each destination MAC address the same slave is selected.

mode=3 (broadcast)

This method is based on broadcast policy that is it transmitted everything on all slave interfaces. It provides fault tolerance. This can be used only for specific purposes.

mode=4 (802.3ad)

This mode is known as a Dynamic Link Aggregation mode that has it created aggregation groups having same speed. It requires a switch that supports IEEE 802.3ad dynamic link. The slave selection for outgoing traffic is done based on a transmit hashing method. This may be changed from the XOR method via the xmit_hash_policy option.

mode=5 (balance-tlb)

This mode is called Adaptive transmit load balancing. The outgoing traffic is distributed based on the current load on each slave and the incoming traffic is received by the current slave. If the incoming traffic fails, the failed receiving slave is replaced by the MAC address of another slave. This mode does not require any special switch support.

mode=6 (balance-alb)

This mode is called adaptive load balancing. This mode does not require any special switch support.

Configure Network Bonding on CentOS

1) Create the bond file ( ifcfg-bond0 ) and specify the IP address, netmask & gateway.

# vi /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

IPADDR=192.x.x.x

NETMASK=255.255.255.0

GATEWAY=192.x.x.1

TYPE=Bond

ONBOOT=yes

NM_CONTROLLED=no

BOOTPROTO=static

2) Edit the files of eth0 & eth1 and make sure you enter the master and slave entry.

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

HWADDR=08:00:27:5C:A8:8F

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=no

MASTER=bond0

SLAVE=yes

# vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=no

MASTER=bond0

SLAVE=yes

3) Create the Bond file(bonding.conf)

# vi /etc/modprobe.d/bonding.conf

alias bond0 bonding

options bond0 mode=1 miimon=100

4) Now Restart the network Service

# service network restart

5) To check the bond interface, use command:

# ifconfig bond0

6) To verify the status of bond interface, use command:

# cat /proc/net/bonding/bond0

Configuring Bonding on Ubuntu 16 LTS

apt-get install ifenslave

add bonding line into /etc/modules

# /etc/modules: kernel modules to load at boot time.

#

# This file contains the names of kernel modules that should be loaded

# at boot time, one per line. Lines beginning with "#" are ignored.

loop

lp

rtc

bonding

edit /etc/network/UltaHost and follow the example below. Our two network cards are called em1 and em2. change these to match your name.

#

auto em1

iface em1 inet manual

bond-master bond0

bond-primary em1

#

auto em2

iface em2 inet manual

bond-master bond0

#

#

auto bond0

iface bond0 inet static

address 66.45.255.2

netmask 255.255.255.248

gateway 66.45.255.1

dns-search interserver.net

dns-nameservers 64.20.34.2 66.45.228.3

bond-slaves none

bond-mode 0

bond-miimon 100

bond_downdelay 200

bound_updelay 200

To restart networking you can do /etc/init.d/networking restart. But we recommend doing a reboot instead.

Your ifconfig should look something like this

bond0 Link encap:Ethernet HWaddr 00:25:90:47:87:b5

inet addr:66.45.255.2 Bcast:66.45.255.207 Mask:255.255.255.248

inet6 addr: fe80::225:90ff:fe47:87b5/64 Scope:Link

UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1

RX packets:4957372721 errors:0 dropped:867 overruns:572 frame:0

TX packets:4181951926 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:4937047448966 (4.9 TB) TX bytes:4897187667435 (4.8 TB)

em1 Link encap:Ethernet HWaddr 00:25:90:47:87:b5

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:2683163175 errors:0 dropped:24 overruns:572 frame:0

TX packets:2091204534 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:2670257332642 (2.6 TB) TX bytes:2444195037171 (2.4 TB)

Memory:f7100000-f717ffff

em2 Link encap:Ethernet HWaddr 00:25:90:47:87:b5

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:2274209569 errors:0 dropped:843 overruns:0 frame:0

TX packets:2090747386 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:2266790139678 (2.2 TB) TX bytes:2452992621742 (2.4 TB)

Interrupt:20 Memory:f7200000-f7220000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:65536 Metric:1

RX packets:225 errors:0 dropped:0 overruns:0 frame:0

TX packets:225 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1

RX bytes:17439 (17.4 KB) TX bytes:17439 (17.4 KB)

/proc/net/bonding/bond0 should look something like this:

Bonding Mode: load balancing (round-robin)

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 200

Slave Interface: em2

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:25:90:47:87:b5

Slave queue ID: 0

Slave Interface: em1

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:25:90:47:87:b4

Slave queue ID: 0

Sample Network Configuration on Cisco Router (Nexus 3048)

Below is an example of setting up a port channel (link aggregation or lag port) on a Cisco switch.

Vlan interface

interface Vlan348

description ds4348

no shutdown

no ip redirects

ip address 64.20.40.1/30

Port channel interface

interface port-channel11

description ds4348

switchport

switchport mode trunk

switchport trunk native vlan 348

switchport trunk allowed vlan 348

no negotiate auto

Physical Interface(s)

interface Ethernet1/31

description ds4348

switchport

switchport mode trunk

switchport trunk native vlan 348

switchport trunk allowed vlan 348

channel-group 11 mode active

interface Ethernet1/32

description ds4348

switchport

switchport mode trunk

switchport trunk native vlan 348

switchport trunk allowed vlan 348

channel-group 11 mode active
Share this Doc

What is Network Bonding? Types of Network Bonding

Or copy link

Table Of Contents