Wednesday 24 September 2014

IP Bonding

In linux IP bonding generally refers to aggregate multiple network interfaces into single logical interface called as bonded interface. The activity of the bonded interface depends on the mode chosen. There are different modes available in IP bonding that provides necessary integrity and redundancy. Here we will discuss how to bond the two interfaces using this technique.

1. Create configuration file bond0:

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

DEVICE=bond0
IPADDR=192.168.0.10
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
USERCTL= no
BOOTPROTO= none
ONBOOT= yes

2. Replace the text of your first ethernet interface with following:

DEVICE= eth0
USERCTL= no
ONBOOT= yes
MASTER= bond0
SLAVE= yes
BOOTPROTO= none

3. Replace the text of your second ethernet interface with following:

DEVICE= eth1
USERCTL= no
ONBOOT= yes
MASTER= bond0
SLAVE= yes
BOOTPROTO= none

Make sure to add interface name you are using in DEVICE and bond configuration file in MASTER.

4. Make sure Loading bond kernel modules while using bonding. By default this module in not loaded. Append the configuration in configuration file of modules.

# vim /etc/modprobe.conf

alias bond0 bonding
options bond0 mode=6 miimon=100

miimon: This specifies how frequently MII link is monitored. The state of each slave is monitored every 100 milli seconds.

mode: Specifies one of the bonding facilities. Default is round robin. The list of all the modes is given in the end of this tutorial.

5. Now load the module using below command.

# modprobe bonding

6. Restart the service of network and you are done.

# /etc/init.d/network restart

7. Check using ifconfig command and manually test the setup.

List of all the modes available in bonding:

1. balance-rr or 0

Distribute packets in alternate sequence.

2. active backup or 1

Only one interface will be active at a time. Due to failure if one goes down, then other comes up automatically.

3. balance-xor or 2

Packet transmission is based on the specific hash policy, provides load balancing and fault tolerance.

4. broadcast or 3

broadcast policy, transmitted through all the available interfaces.

5. 802.3ad or 4

Dynamic Link aggregation, the interfaces that share the same link speed.

6. balance-tlb or 5

The outgoing traffic is distributed according to current load. adaptive transmit load balancing.

7. balance-alb or 6

The outgoing traffic is distributed according to current load. adaptive transmit and receive load balancing.

No comments:

Post a Comment