Bonding (Port Trunking) in 5 steps on Linux December 18, 2010Posted by Tournas Dimitrios in Linux, Linux admin tools.
Tags: Linux bonding, Port Trunking
Bonding is the same as port trunking. In the following I will use the word bonding because practically we will bond interfaces as one.
But still…what is bonding?
Bonding allows you to aggregate multiple ports into a single group, effectively combining the bandwidth into a single connection. Bonding also allows you to create multi-gigabit pipes to transport traffic through the highest traffic areas of your network. For example, you can aggregate three megabits ports (1 mb each) into a three-megabits trunk port. That is equivalent with having one interface with three megabits speed.
Where should I use bonding?
You can use it wherever you need redundant links, fault tolerance or load balancing networks. It is the best way to have a high availability network segment. A very useful way to use bonding is to use it in connection with 802.1q VLAN support (your network equipment must have 802.1q protocol implemented). In 5 steps can you set up to bound your network interface carts .
Step 1 :
Create the file ifcfg-bond0 with the IP address, netmask and gateway. Shown below is my test bonding config file.
$ cat /etc/sysconfig/network-scripts/ifcfg-bond0
Step 2 :
Modify eth0, eth1 and eth2 configuration as shown below. Comment out, or remove the ip address, netmask, gateway and hardware address from each one of these files, since settings should only come from the ifcfg-bond0 file above.
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Settings for Bond
$ cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Settings for bonding
$ cat /etc/sysconfig/network-scripts/ifcfg-eth2
Step 3 :
Set the parameters for bond0 bonding kernel module. Add the following lines to /etc/modprobe. conf
# bonding commands
alias bond0 bonding
options bond0 mode=balance- alb miimon=100
Step 4 :
Load the bond driver module from the command prompt.
$ modprobe bonding
Step 5 :
Restart the network, or restart the computer.
$ service network restart # Or restart computer
When the machine boots up check the proc settings.
$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.0.2 (March 23, 2006)
Bonding Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:13:72:80: 62:f0
Look at ifconfig -a and check that your bond0 interface is active. You are done!