Bonding Ethernet Devices


Bonding takes 2 or more physical network cards and turns them into one single device. For example you can take 2 gigabit ports (eth0 and eth1) and bond them so they show as a bond0 interface and in theory achieve 2GB pipeline. For this example ill be using redhat/centos but the same should be the same across the board distribution wise.

Bear in mind not all routers support bonding. Make sure the device your system is plugged into can support and handle bonding


Create a bond0 configuration file

vi /etc/sysconfig/network-scripts/ifcfg-bond0


Append following lines to it:
DEVICE=bond0
IPADDR=YOUR_IPADDRESS
NETWORK=YOUR_GATEWAY
NETMASK=YOUR_NETMASK
USERCTL=no
BOOTPROTO=none
ONBOOT=yes


Modify eth0 and eth1 config files:

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

Modify the file or append as necessary to match the following

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


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

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


Load bond driver/module

You need to modify kernel modules configuration file so that the bond0 device comes up properly


vi /etc/modprobe.conf


Append following two lines:

alias bond0 bonding
options bond0 mode=balance-alb miimon=100


Test configuration

First, load the bonding module


modprobe bonding


Restart networking service in order to bring up bond0 interface


service network restart


Verify everything is working


less /proc/net/bonding/bond0


The Output from that command should be similiar to the following


Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0


Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:00:00:00:00:00


Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 11:11:11:11:11:11

List all interfaces


ifconfig


Output from ifconfig should be similiar to the following

bond0 Link encap:Ethernet HWaddr 00:cc:ee:ff:11:bb
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2804 errors:0 dropped:0 overruns:0 frame:0
TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:250825 (244.9 KiB) TX bytes:244683 (238.9 KiB)


eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:2809 errors:0 dropped:0 overruns:0 frame:0
TX packets:1390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:251161 (245.2 KiB) TX bytes:180289 (176.0 KiB)
Interrupt:11 Base address:0x1400


eth1 Link encap:Ethernet HWaddr 11:11:11:11:11:11
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:502 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:258 (258.0 b) TX bytes:66516 (64.9 KiB)
Interrupt:10 Base address:0x1480


Now its the fun of configuring your router to accept bonding from that machine....which is unfortunatly out of the scope of this article