Configuring bonding/teaming/aggregation in Linux

Like I said in the post regarding Solaris, now I’ll leave here the indications for configuring bonding in Linux.
We can perform the bonding in several ways, though I’ll mention only the dinamically but using sysfs.

1. Creating the bond

# modprobe bonding
# echo +app_bond0 > /sys/class/net/bonding_masters
bonding: app_bond0 is being created...

2. Adding slaves interfaces to the bond

# echo +eth0 > /sys/class/net/app_bond/bonding/slaves
bonding: app_bond0: doing slave updates when interface is down
bonding: app_bond0: Adding slave eth0
bonding: app_bond0: master_dev is not up in bond_enslave
e1000: eth0 NIC Link is Up 1000 Mps Full Duplex, Flow Control: RX
bonding: app_bond0: enslaving eth0 as an active interface with an up link.

# echo +eth1 > /sys/class/net/app_bond/bonding/slaves
bonding: app_bond0: doing slave updates when interface is down
bonding: app_bond0: Adding slave eth1
bonding: app_bond0: master_dev is not up in bond_enslave
e1000: eth1 NIC Link is Up 1000 Mps Full Duplex, Flow Control: RX
bonding: app_bond0: enslaving eth0 as an active interface with an up link.

3. Checking the newly created bond:

# cat /sys/class/net/app_bond/bonding/slaves
eth0 eth1

# ifconfig app_bond0
app_bond0 Link encap: Ethernet  HWaddr 08:00:27:90:9E:86
BROADCAST MASTER MULTICAST  MTU:1500  Metric:1
RX packets:72 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX byte:10944 (10.6 Kib)   TX bytes:0 (0.0 b)

OR

# cat /proc/net/bonding/app_bon0 (you will see all the definition about the bonding.

By default the the bonding is configured in a active-active setup round-robin. If you wish to turn it into a active-backup you will need to do the following:

# echo 1 > mode
bonding: app_bond0: Setting to mode active-backup (1).

And to active link based monitoring:


# echo 1000 > /sys/class/net/app_bond0/bonding/miimon
bonding: app_bond0: Setting MII monitoring interva to 1000.

After this you do what is normal to configure a network interface or by using ifconfig or by setting up in the config files.

Now and moving on to VLAN, check if you have the comand vconfig, if you don’t have it install it.

1. Load the module and add the bond to the vlan config, the interface must be up for the vconfig command to work.


# modprobe 8021q
# vconfig add app_bond0 100
Added VLAN with VID == 100 to IF -:app_bond0:-

2. Setting the ip and bringing the vlan up

# ip addr add dev app_bond0.100 192.168.0.1/24 brd +
# ip link set dev app_bond0.100 up

After this you shold be ready to go. 😀

Anyway for all the options covering with bonding check the kernel docs file bonding.txt.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s