Network Interface Bonding
From RidgeRun Developer Connection
Some mobile embedded devices have multiple Ethernet interfaces. To make it easy for the user, it shouldn't matter which Ethernet jack they use. One way to accomplish this is to bond the two interfaces so they both behave the same from a Linux application point of view.
Run make config to enable the bonding driver and the busybox
Linux bonding driver
The SDK needs to be configure to enable the Linux bonding driver.
Run make config and enable the bonding driver support:
Kernel Configuration -> Device -> Device Drivers -> Network device support -> Bonding driver support
Busybox ifenslave utility
The SDK needs to be configure to enable the Busybox ifenslave utility.
File System Configuration-> Select target's file system software -> busybox -> Busybox configuration -> Networking Utilities ->ifenslave
The following assumes the Linux bonding driver was build as a module and the two network interfaces to be bonded are eth0 and eth1.
modprobe bonding ifconfig eth0 down ifconfig eth1 down ifconfig bond0 up ifenslave bond0 eth0 eth1 ifconfig bond0 192.168.0.1 netmask 255.255.255.0 ifconfig eth0 up ifconfig eth1 up
Bonded interface testing
A simple way to test the configuration is to use two laptop computers, both configured with different fixed IP addresses on the same sub-lan. Then run the ping command on each device trying to ping the other devices. Since we are using bonding the ping packets will not be routed by the target device, thus the ping from one laptop to the other will fail.
I used a LeopardBoard 368 with an Ethernet USB dongle. I enabled USB ACM driver to support the Ethernet dongle. I also configured the LeopardBoard 368 USB interface to operate in host mode.
Commands to be run on laptop 1 with IP address 10.111.0.2 have a yellow background. Commands to be run on laptop 2 with IP address 10.111.0.4 have an aqua background. Commands run on the target hardware have a XXX background.
modprobe bonding ifconfig eth0 down ifconfig eth1 down ifconfig bond0 up ifenslave bond0 eth0 eth1 ifconfig bond0 10.111.0.59 netmask 255.255.255.0 ifconfig eth0 up ifconfig eth1 up