HowTos/USB Networking
From OpenZaurus
This describes how to use the "traditional" USB cable to link your Zaurus and your desktop/laptop to do networking.
If you have a model (like Cxx00) which are able to use USB host cables, and want to use an USB network (ethernet) adapter , please see HowTos/UsbEthernetAdapterSupportOnUsbHost.
If you're running Gentoo, you may want to see HowTos/Bridging with Gentoo.
NOTE
- The g_ether module will be necessary for Zaurus running the 2.6 kernel (default on newer releases for most Zs)
- The cdc_ether and cdc_subset modules are required as well as usbnet on the attached linux host machine if it is running 2.6.16 or later, otherwise it will fail to create an interface called usb and /var/log/messages will report the usb device is not claimed by any driver! (These modules may be loaded automatically when g_ether is loaded on the Z and cable connected, depending on your distro)
This Guide will hopefully help you set up a connection between your zaurus and your network/internet via it's usb cable connecting it to the "host" computer, if you like and it is recommended, you can have your z assigned an ip address by a "DHCP" server such as an ADSL router, or the host computer, etc. to make things even more automated and simple...
Lets Begin:
(firstly, DHCP server/client is nice and easiest but not necessary)
(secondly, in all examples replace the occurrences of X 's with you choice of suitable/relevant IP addresses and networks.)
- NOTE
- You may prefer not choosing the same network class for this USB connection, than on other existing networks of your host system. For instance, you may choose 192.168.1.x if you already have an existing 192.168.0.x active network... of course, basic network topology knowledge and IP numbering schemes may come handy.
- Also, you may wish not to use bridging, but rather a dedicated network, and masquerading, for instance.
(thirdly, if your running pdaxrom, youll most likely have to transfer all config file to you pc for editing via which ever means possible, as i couldnt get "vi" to work properly...)
- Isn't this irrelevant in this wiki, since we deal with OpenZaurus, and vi works allright AFAIK ? -- OlivierBerger 17:52, 26 May 2006 (BST)
(fourthly, if your running some wacky old kernel and your z doesnt show up in usbview or in the system messages display when you plug it in, then you'll need to look into building/installing some modules mentioned in Generic (USB) another paper as its not covered in this one...)
Taken from a post i made in the following thread, inspired by an earlier post in the same thread by NickNak introducing me to this method, but whose guide didnt work for me (telemetric_au).
Contents |
On the "host" machine
You may configure the networking setup in different maners :
- with bridging (option 1),
- or with masquerading (option 2)
Option 1 : Setup bridging between USB link and regular host network
The setup i got it working under is fairly common, but im confident it would also work with many others...
- an ADSL Router/Hub/DHCP server connected to
- a PPC Debian etch box via USB
- and i386 Debain etch box via ethernet (also worked under sid)
- which is in turn connected to my 5500's USB cradle
Step #1 - Install "bridge-utils" package
- On your Z's "Host Box" installed with Debian, for instance, run from a command prompt:
apt-get install bridge-utils
(this gives you the "brctl" command used bellow)
Step #2 - Edit /etc/network/interfaces
- Edit the file /etc/network/interfaces using a text editor running with root (su) access as displayed below, without changing anything else (i.e. other interfaces) which may allready be there but are not mentioned or adjusted in the following box of code.
# The loopback network interface auto lo iface lo inet loopback # The primary network/internet interface auto eth0 iface eth0 inet static address 0.0.0.0 netmask 0.0.0.0 # The Virtual Bridging Interface linking usb0 to eth0 auto br0 iface br0 inet dhcp pre-up brctl addbr br0 pre-up brctl addif br0 eth0 post-down brctl delbr br0 # The Zaurus's Connnection allow-hotplug usb0 mapping hotplug script grep map usb0 iface usb0 inet static # The following is a dummy address/netmask, # and is only used initially to create the usb0 interface, # so it can then be set to 0.0.0.0 just like eth0 :) address 192.168.X.X netmask 255.255.255.X post-up ifconfig usb0 0.0.0.0 up post-up brctl addif br0 usb0 post-down brctl delif br0 usb0
- Optionally if you didn't want to use DHCP or dont have it running switch the setup code for br0 from above with the following.
# The Virtual Bridging Interface linking usb0 to eth0 auto br0 iface br0 inet static address 192.168.X.X netmask 255.255.255.X pre-up brctl addbr br0 pre-up brctl addif br0 eth0 post-down brctl delbr br0
Step #3 - Restart your networking system
- (without rebooting, by executing the following command line.)
/etc/init.d/networking restart
Option 2 : setup masquerading between USB link and regular host network
More detailed instructions are provided in : HowTos/USB Networking Without Bridging
To make it short, you may proceed with the following steps (on Debian) :
- install ipmasq
- configure /etc/network/interfaces like :
iface usb0 inet static address 192.168.0.200 netmask 255.255.255.0 pointopoint 192.168.0.202
- ifup usb0
- restart ipmasq : /etc/init.d/ipmasq restart
On the Zaurus
Load the appropriate module
If necessary, load the appropriate module, after having connected the USB cable.
For instance, with releases 3.5.4.x, issue, as root :
modprobe g_ether
Check with dmesg and ifconfig -a, on both machines, tha a new usb0 interface has been setup.
Step #4 - Configure your Zaurus
- now depending on which image your running, the changes you may need to make may be different...
With GUI (OPIE/GPE)
You will configure the usb0 interface.
Note that depending on your distribution, default values may be selected for this interface.
For instance, in GPE, it may be a static setup on the 192.168.0.202 IP with gateway on 192.168.0.200.
- if you have GUI network setup interface use that:
check the automatically bring-up option if present set ip address, subnet, gateway, dns's as needed (with gateway being your pc's br0 IP (or usb0 or possibly even the eth0)
Without GUI, in console mode
- if you dont have a GUI or prefer not to use one and have an /etc/network/interfaces file, edit it as follows:
(Note: iface command is not recogised in OpenZaurus 3.5.4.1 (Opie 1.2.1))
For auto dhcp assigned address add/edit:
iface usb0 inet dhcp
For a static IP address add/edit:
iface usb0 inet static #your z's address address 192.168.X.X #your computer's address (this will most likely be the address for br0, #but may instead be usb0 if you needed to make usb0 static for some reason...) pointopoint 192.168.X.X netmask 255.255.255.X
Note that you may want to remove the commented lines (the ones starting with a '#' sign) from the above snippet in your /etc/network/interfaces, to avoid any problem parsing the interface definition OlivierBerger 17:45, 26 May 2006 (BST)
- if you dont have an /etc/network/interfaces file but have an /etc/hotplug/usbdnet.conf file such as in pdaxrom edit it (either on your pc or via "vi" from the base root prompt (before pdaxrom) )
DHCP:
#IP=192.168.X.X #NETMASK=255.255.255.X DHCPS=no I DHCPC=yes
Static:
#IP=192.168.X.X #NETMASK=255.255.255.X DHCPS=no DHCPC=no
- Specify the Zaurus's DNS if not allready specified with for example a GUI
edit /etc/resolv.conf to add the IP of your DNS server as found in your PC's /etc/resolv.conf which in my case was the router's address
nameserver X.X.X.X
Step #5 - Take a break
it hopefully should be all working sweet now internet included, so go lie down and get to sleep early for a change ;)
if not try contacting me via the oesf forums for some assistance if i can be of any...
here is a copy of my system messages from insertation through to IP assignment:
Apr 29 09:14:05 debian kernel: usb 2-1.3: new full speed USB device using uhci_hcd and address 5 Apr 29 09:14:06 debian kernel: usbcore: registered new driver cdc_ether Apr 29 09:14:06 debian kernel: usb0: register 'zaurus' at usb-0000:00:1d.1-1.3, Sharp Zaurus SL-5x00, b6:70:52:a9:19:95 Apr 29 09:14:06 debian kernel: usbcore: registered new driver zaurus Apr 29 09:14:06 debian kernel: device usb0 entered promiscuous mode Apr 29 09:14:06 debian kernel: br0: port 2(usb0) entering learning state Apr 29 09:14:21 debian kernel: br0: topology change detected, propagating Apr 29 09:14:21 debian kernel: br0: port 2(usb0) entering forwarding state
for those interested im currently running kernel v. 2.6.15-1-686 with udev v. 0.089-1
Some References
http://www.gumstix.org/tikiwiki/tiki-index.php?page=Networking

