Linux Basics: Create Network Bonding On Debian 7 / Ubuntu 13.10
What is network bonding?
Network bonding is a method of combining (joining) two or more network interfaces together into a single interface. It will increase the network throughput, bandwidth and give redundancy. If one interface is down or unplugged, the other one will keep the network traffic alive. Network bonding can be used in situations wherever you need redundancy, fault tolerance or load balancing networks.
Linux allows us to bond multiple network interfaces into single interface using a special kernel module named bonding. The Linux bonding driver provides a method for combining multiple network interfaces into a single logical “bonded” interface. The behavior of the bonded interfaces depends upon the mode; generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring may be performed.
Types of Network Bonding
According the to the official documentation, here is the types of network bonding modes.
Round-robin policy: It the default mode. It transmits packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
Active-backup policy: In this mode, only one slave in the bond is active. The other one will become active, only when 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.
XOR policy: Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
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.
- Ethtool support in the base drivers for retrieving the speed and duplex of each slave.
- A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode.
Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.
- Ethtool support in the base drivers for retrieving the speed of each slave.
Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.
Setup Network Bonding On Debian 7 / Ubuntu 13.10 Desktop
In this handy tutorial let us see how to setup network bonding on Debian 7. Though it was tested on Debian 7, it should work on Ubuntu and its derivatives.
We need atleast two or more network cards.
I have three network interfaces, namely eth0, eth1 and eth2 in my Debian 7 LXDE desktop. Let us combine two NICs (eth1 and eth2) and make them into one NIC named bond0.
Install Bonding Kernel Module
First, we have to install bonding kernel module using the command:
# apt-get install ifenslave-2.6
Before going further, stop networking service.
# /etc/init.d/networking stop
Warning: You should not enter the above command over SSH connection.
Configure Bond0 Interface
First, let us create a bond0 configuration file as shown below.
Go to the directory where Debian/Ubuntu stores the network configuration files. By default, Debian and its derivatives stores the network configuration files under /etc/network/ directory.
Create bond0 configuration file under the above mentioned directory.
# vi /etc/network/interfaces
Add the following lines marked in red color to create network bond for eth1 and eth2.
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The first network bond auto bond0 iface bond0 inet static address 192.168.1.200 netmask 255.255.255.0 gateway 192.168.1.1 slaves eth1 eth2 bond-mode 1 bond-miimon 100 bond_downdelay 200 bond_updelay 200
Save and close file.
Note: Here we will be configuring mode1(active-backup). 192.168.1.200 is bond0 IP address.
Next we have to load up the bond0 interface into the kernel. To do that, create a new file /etc/modprobe.d/bonding.conf,
# vi /etc/modprobe.d/bonding.conf
Add the following line in it.
alias bond0 bonding options bonding mode=1 arp_interval=2000 arp_ip_target=192.168.1.1
Warning: Without this file, you’ll get warning message when you restart network service. Here 192.168.1.1 is my router(gateway) ip address. Save and close the file.
Now let us enable the bonding kernel module, using the command:
# modprobe -v options bonding mode=1 arp_interval=2000 arp_ip_target=192.168.1.1
Next Start/Restart network service to take effect the changes.
# service network start
Test Network Bonding
Now enter the following command to check whether the bonding interface bond0 is up and running:
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: eth1 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 200 Down Delay (ms): 200 Slave Interface: eth1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 08:00:27:16:07:6a Slave queue ID: 0 Slave Interface: eth2 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 08:00:27:60:18:bb Slave queue ID: 0
As you see in the above output, the bond0 interface is up and running and it is configured as active-backup(mode1) mode. In this mode, only one slave in the bond is active. The other one will become active, only when the active slave fails.
To view the list of network interfaces and their IP address, enter the following command:
bond0 Link encap:Ethernet HWaddr 08:00:27:16:07:6a inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe16:76a/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:114 errors:0 dropped:31 overruns:0 frame:0 TX packets:197 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:14269 (13.9 KiB) TX bytes:29286 (28.5 KiB) eth0 Link encap:Ethernet HWaddr 08:00:27:ac:65:e9 inet addr:192.168.1.102 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:feac:65e9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1164 errors:0 dropped:0 overruns:0 frame:0 TX packets:42 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:89712 (87.6 KiB) TX bytes:8706 (8.5 KiB) eth1 Link encap:Ethernet HWaddr 08:00:27:16:07:6a UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:77 errors:0 dropped:0 overruns:0 frame:0 TX packets:197 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:11459 (11.1 KiB) TX bytes:29286 (28.5 KiB) eth2 Link encap:Ethernet HWaddr 08:00:27:16:07:6a UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:37 errors:0 dropped:31 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2810 (2.7 KiB) TX bytes:0 (0.0 B) 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:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
As per the above output, bond0 is configured as master; eth1 and eth2 are configured as a slave.
Want to create network bonding on RHEL based systems, check out our previous article.
Source & Reference Links:
Like us on Facebook
We need your assistance to stay live
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04 : Power Commands, power management application created by the Atareao team , this app helps users to...0 comments |
- Install Uget Download Manager In Ubuntu, Fedora, Debian : uGet is a very light-weight and powerful open source download manager. On March 4th, 2014 Uget Do...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- Download Elementary OS 'Luna' Official Wallpapers : Hi Guys, Am a great lover of Elementary OS, so I like to move almost everywhere with some its beaut...0 comments |
- Install Crashplan backup tool in Linux : CashPlan is an automated backup solution that either uses the CrashPlan Central server or any other ...0 comments |
- Fedora 21 Scheduled For Release In October
- Install Uget Download Manager In Ubuntu, Fedora, Debian
- Download Elementary OS ‘Luna’ Official Wallpapers
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04
- 5 Android Apps that’s Going to Make Running Your Business Less Stressful
- Puppet agent Install Using Script
- Install Corosync and Pacemaker On CentOS 6.5
- Install Fail2Ban On Ubuntu Server 13.04/13.10
- How To Install Google Chrome in Fedora 20, 19, 18
- How to surf using Tor Browser Bundle
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .