Pages

Sunday 3 August 2014

LINUX NETWORK INTERFACE BONDING

Summary task: configure and un-configure NIC bonding on Linux

Installation

sudo apt-get install ifenslave
Install ifenslave to attach or detach slave network interface to bonding device

Step 1: Ensure kernel support
Before Ubuntu can configure your network cards into a NIC bond, you need to ensure that the correct kernel module bonding is present, and loaded at boot time.

Edit your /etc/modules configuration:

sudo vi /etc/modules
Ensure that the bonding module is loaded:

# /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
Step 2: Configure network interfaces

Ensure that your network is brought down:

sudo stop networking
Then load the bonding kernel module and edit network configuration:

sudo modprobe bonding
sudo vi /etc/network/interfaces

For example, to combine eth0 and eth1 as slaves to the bonding interface bond0 using a simple active-backup setup, with eth0 being the primary interface:

#eth0 is manually configured, and slave to the "bond0" bonded NIC
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0

#eth1 ditto, thus creating a 2-link bond.
auto eth1
iface eth1 inet manual
bond-master bond0

# bond0 is the bonding NIC and can be used like any other normal NIC.
# bond0 is configured using static network information.
auto bond0
iface bond0 inet static
address 192.168.1.10
gateway 192.168.1.1
netmask 255.255.255.0
bond-mode active-backup
bond-miimon 100
bond-slaves none

Step 3: Checking and Start up bonding interface

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

802.3ad info
LACP rate: fast
Aggregator selection policy (ad_select): stable
bond bond0 has no active aggregator

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:f5:b7:11
Aggregator ID: N/A

Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:f5:b7:1b
Aggregator ID: N/A
To bring up the bonding interface, run

ifup bond0
To bring down the bonding interface, run

ifdown bond0


Remove

Bring down the device bond0

ifconfig bond0 down

Remove slave interface from bond0 device, first eth0

echo "-eth0" > /sys/class/net/bond0/bonding/slaves

and eth1:

echo "-eth1" > /sys/class/net/bond0/bonding/slaves

Next, remove the config and files related to bond0 device

echo "-bond0" > /sys/class/net/bonding_masters
and
rmmod bonding

Source:
https://help.ubuntu.com/community/UbuntuBonding

No comments:

Post a Comment