Mar 302011


By using the USB networking features of Linux you can create a TCP/IP network and achieve the same functionality that is given with an ethernet or 802.11 network.  That is to say, you instantly get all of the network stack protocols such as  ssh, ftp, http, etc.  With USB networking you can easily add several new networking interfaces to a host machine.  These new interfaces can be configured to the same network or can be configured as seperate networks.  A USB network can also be bridged and shared with ethernet and 802.11 networks.

I have a beagleboard rev. C4 with Ubuntu running on an 8 GB SD card.  The beagleboard does not have an ethernet port or wifi chip, however, it does have both USB host and USB OTG ports.  The goal was to connect the ZipIt to the beagleboard with USB and then bridge to the ZipIt’s wireless connection.  By bridging the two networks, both the beagleboard and the ZipIt can utilize the wifi connection and access the web over the LAN.

  1. network a ZipIt Z2 to a beagleboard using USB
  2. create a bridge to the ZipIt’s wifi connection and share it with the beagleboard

The beagleboard has the ability to act as both a USB host and a USB client.  The connection being described in this post has the beagleboard assigned as the host and the ZipIt in USB client mode.  The ZipIt can also act as the USB host, but unlike the beagleboard, it cannot be both at the same time.  A kernel that has been configured to put the ZipIt in USB client mode is a requirement.  I compiled my own kernel using buildroot and the kernel sources from anarsoul’s tree with this .config and this additional patch, also provided by anarsoul.  At the time of this post, he has not released a compiled version of the USB client, I’m sure that if you poke him, he will be happy to help, otherwise I can also provide a binary.

You will also need to create a USB adapter for the ZipIt.  The USB wiring–>pin connections are the same as those for the USB host cable, the only difference you may consider is a male end.  The configuration details below can easily be adapted to work with a ZipIt to ZipIt, or a ZipIt to laptop connection.

It is recommended to use the z2lite-rc8 userland by wicknix.  This userland has the iptables already included.  The usage of other userlands will need  this package installed (i.e. z2sid-rc3).

The additions needed to /etc/network/interfaces for the beagleboard and ZipIt are as follows.

beagleboard –> /etc/network/interfaces

iface usb1 inet static




gateway (this is the IP assigned to the ZipIt)


ZipIt  –> /etc/network/interfaces

auto usb0
iface usb0 inet static


up echo 1 > /proc/sys/net/ipv4/ip_forward
up iptables -t nat -A POSTROUTING -o wlan0 -s -j MASQUERADE
up iptables -t nat -A PREROUTING -i wlan0 -p tcp –dport 3074 -j DNAT –to-destination
up iptables -A FORWARD -i wlan0 -d -p tcp –dport 3074 -j ACCEPT

down echo 0 > /proc/sys/net/ipv4/ip_forward
down iptables -t nat -D POSTROUTING -o wlan0 -s -j MASQUERADE


Boot the beagleboard and the ZipIt.  Log in to the ZipIt and issue the following commands.

z2sid-rc3:~#:modprobe g_ether

z2sid-rc3:~#:ifdown usb0

z2sid-rc3:~#:ifup usb0

It’s assumed the ZipIt is already connected to a wireless AP and can access the web.  Please note that you configure and connect the ZipIt to the wireless AP as normal.  The ZipIt’s USB cable can now be plugged into the beagleboard’s USB hub.  That should be it.  Open your beagleboard’s web browser and try to access the web.


Networking problems can arise from many sources.  The problem may be with the hardware, software, environment, configuration, etc., and can often be a combination of the possibilities.  Here’s a few tips for troubleshooting problems.

Start with establishing a ping signal.  It is best to clear any rules in the iptables that could prevent a response from the ping request.

z2sid-rc3:~#:iptables -L –> lists all the rules for the ‘firewall’

z2sid-rc3:~#:iptables -F –> clears all the rules for the ‘firewall’.  Should be the same as if a firewall was not up.

With USB networking the first thing to check of course would be the USB connection.  This can be done with a userland tool called ethtool.  The ethtool package can be found in most repositories, including those of Ubuntu.  If you are using a buildroot based userland such as z2lite you may need to build the ethtool package yourself.  The z2lite-rc8 package has the needed userland tools for creating the network bridge.

z2sid-rc3:~#:ethool usb0 –> should return Link Detected: yes

z2sid-rc3:~#:ethtool -i usb0 –> returns info about the driver and firmware.  Look for driver: g_ether.

z2sid-rc3:~#:ping –> looking for a ping response of  ~ 2 ms

Once you have a ping response you can then start adding rules to the iptables that will bridge the USB network and the ZipIts wifi connection.





Sorry, the comment form is closed at this time.

© 2016 engine12