Bonding Ethernet Ports

You can combine the Ethernet ports on a Linux server together to appear as a single port with one IP address. Combining the Ethernet ports together is called link aggregation or bonding, this page will refer to it as bonding. The advantage is that it increases the bandwidth to your server. Two NICs double the bandwidth, 3 triples, 4 quadruples, etc..

You can configure your Linux server for bonding Ethernet ports for increased bandwidth either of two ways: manually or through Webmin. In order to do this, you will need a switch that supports bonding of its Ethernet ports using the IEEE802.3ad LACP (link aggreation control protocol). For this page, I will be using Cisco switches (older el-cheapo 2950 and verified on a newer PoE 3560)

Webmin Method:

1. First update to the latest version of Webmin (at least 1.6) by clicking on the Update Webmin button on the front page. This only updates Webmin and not any of the other programs. If you are up to date, there will be no button shown.

2. Go to Webmin - Network Configuration - Network Interfaces - Add a New Bonding Interface. Set it as bond0 (0 - zero) and give it the current IP address of your eth0 port.

3. On the same screen, set the teaming partners to "eth0 eth1" and the mode to "802.3ad" and then Create. At this point, you haven't applied any settings.

4. At this point, it will automatically modify eth0 and eth1 to become bonding slaves and remove any IP addresses that exist:

5. You can go ahead and apply the configuration now. If you've kept the same IP address I've had success in retaining the connection. If you used a different IP address then naturally, you will lose connection as you've configured your server with a new IP address.

After the Manual Configuration Method, I'll detail configuring a Cisco switch for bonding which they call Etherchannel.

Manual Configuration Method:

Step #1: Create a Bond0 Configuration File

First, you need to create a config file for bond0: etc/sysconfig/network-scripts/ifcfg-bond0 as follows:

 DEVICE=bond0
 IPADDR=192.168.63.254
 NETWORK=192.168.63.0
 NETMASK=255.255.255.0
 USERCTL=no
 BOOTPROTO=none
 ONBOOT=yes

Step #2: Modify eth0 and eth1 config files

eth0: /etc/sysconfig/network-scripts/ifcfg-eth0

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

eth1: /etc/sysconfig/network-scripts/ifcfg-eth1

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

Step # 3: Load bond driver/module

Make a new file /etc/modprobe.d/bonding.conf with the following info (in contrast, Webmin modifies the bond0 file with a module option)

 alias bond0 bonding
 options bond0 mode=4 miimon=100

Step # 4: Update kernel bonding from the Linux prompt:

 #modprobe -rv bonding
 #modprobe bonding
 #service network restart
 

Checking for bonding:

 # ifconfig

bond0 Link encap:Ethernet HWaddr 00:0B:CD:4E:AC:28
 inet addr:192.168.203.190 Bcast:192.168.203.255 Mask:255.255.255.0
 inet6 addr: fe80::20b:cdff:fe4e:ac28/64 Scope:Link
 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
 RX packets:23 errors:0 dropped:0 overruns:0 frame:0
 TX packets:3225 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:1938 (1.8 KiB) TX bytes:208128 (203.2 KiB)

eth0 Link encap:Ethernet HWaddr 00:0B:CD:4E:AC:28
 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
 RX packets:22 errors:0 dropped:0 overruns:0 frame:0
 TX packets:1617 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:1874 (1.8 KiB) TX bytes:104716 (102.2 KiB)
 Interrupt:30

eth1 Link encap:Ethernet HWaddr 00:0B:CD:4E:AD:4D
 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
 RX packets:1 errors:0 dropped:0 overruns:0 frame:0
 TX packets:1608 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:64 (64.0 b) TX bytes:103412 (100.9 KiB)
 Interrupt:29

 #cat /proc/net/bonding/bond0

 Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

 Bonding Mode: adaptive load balancing
 Primary Slave: None
 Currently Active Slave: eth0
 MII Status: up
 MII Polling Interval (ms): 100
 Up Delay (ms): 0
 Down Delay (ms): 0

 Slave Interface: eth0
 MII Status: up
 Speed: 100 Mbps
 Duplex: full
 Link Failure Count: 0
 Permanent HW addr: 00:0b:cd:4e:ac:28
 Slave queue ID: 0

 Slave Interface: eth1
 MII Status: up
 Speed: 100 Mbps
 Duplex: full
 Link Failure Count: 0
 Permanent HW addr: 00:0b:cd:4e:ad:4d
 Slave queue ID: 0

Cisco Switch Configuration:

Step #6: Configure ports 21 and 22 for Etherchannel 1 using VLAN 63:

 interface range fa0/21 - 22
 description Etherchannel 21-22
 switchport access vlan 63
 switchport mode access
 no cdp enable
 channel-group 1 mode active    ; Etherchannel 1 using 802.3ad
 spanning-tree portfast

 interface Port-channel1        ; Etherchannel 1
 switchport access vlan 63
 switchport mode access

Step #7 Test

Switch#show etherchannel summary

 Flags: D - down P - in port-channel
 I - stand-alone s - suspended
 H - Hot-standby (LACP only)
 R - Layer3 S - Layer2
 u - unsuitable for bundling
 U - in use f - failed to allocate aggregator
 d - default port

 Number of channel-groups in use: 1
 Number of aggregators: 1

 Group Port-channel Protocol Ports
 ------+-------------+-----------+-----------------------------------------------
 1 Po1(SU) LACP Fa0/9(Pd) Fa0/10(P)

Voila done - two Ethernet ports bonded together - double the BW. In my case, the server had two gigabit ports so now I have 2 Gbps available. You can bond more than two ports together if needed. It depends on the number of NICs in your server and your switch's specs. For Cisco, I believe the limit is 6 Etherchannels of 8 ports each.

Just playing around with the bonded Ethernet ports. Unplugged eth0, could still connect perfectly fine using eth1, failure messages showed up on the Linux command line. Plugged eth0 back in, came up fine with status messages. Unplugged eth1, failure messages again and still could connect seamlessly. Plugged eth1 back in and everything is happy.

If this page has helped you, please consider donating $1.00 to support the cost of hosting this site, thanks.

Return to

TelecomWorld 101

Copyright July 2013 Eugene Blanchard