Network Interface Bonding

From RidgeRun Developer Connection

Revision as of 20:39, 19 December 2012 by Tfischer (Talk | contribs)
Jump to:navigation, search

Contents

Introduction

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.

Configuration

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    

Runtime configuration

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 magenta background.

modprobe bonding
ifdown -a # only needed if you were using /etc/network/interfaces file
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

Now see if each laptop can exchange packets with the target.

ping 10.111.0.59
ping 10.111.0.59

From the target you should be able to ping both laptops:

while sleep 1 ; do
   ping -c 1 10.111.0.2
   ping -c 1 10.111.0.4
done
<pre>
[[Category:Whitepaper]]
Navigation
Toolbox