Blog |Follow Nick on Twitter| About
 

There are times where you cannot use WiFi, for example my workplace's WLAN uses LEAP, which maemo doesn't support. I found that setting up USB networking on my n800 was a bit of a pain since there isn't a single document... if you check my del.icio.us feed you'll see I bookmarked all I could find with a usbnet tag.

These are the steps I ran through to enable usb networking between my nokia n800 and my fedora 7 laptop.

First we'll start with the basic setup... I'll assume you've read a getting started article similar to mine and already have root & xterm. By default n800 has a usb interface configured, you just need to enable it, so on your n800 type:

sudo gainroot insmod /mnt/initfs/lib/modules/2.6.18-omap1/g_ether.ko ifup usb0
The default settings add an interface with a static ip of 192.168.2.15/24 with a default gateway of 192.168.2.14.

Now lets set up something similar on Fedora, you need to create a file in /etc/sysconfig/network-scripts called ifcfg-usb0 with the following...

DEVICE=usb0 BOOTPROTO=static IPADDR=192.168.2.14 BROADCAST=192.168.2.255 NETMASK=255.255.255.0 NETWORK=192.168.2.0 ONBOOT=no MII_NOT_SUPPORTED=no
Now plug the usb cable into both devices, and on your fedora box (as root) type
ifup usb0
You now have connectivity, of course if you have a default fedora install pinging 192.168.2.15 will fail because of the firewall, it is probably best to temporarily disable the firewall (/etc/init.d/iptables stop) to see if it works, if so move onto configuring your firewall correctly (/etc/init.d/iptables start starts it again) :) You may also get usb conflicts, you can try

rmmod uhci_hcd

but it will disable any USB devices, you have been warned.

With this basic connectivity setup you'll have two issues; you only have connectivity between fedora & n800 nothing else works, and opening any application on n800 causes it to try and connect to your wifi, so lets look at those....

I'm going to assume you used system-config-securitylevel to configure your firewall, its worth noting that any changes you make now will be overwritten by any future use of system-config-securitylevel so it's probably best to take a backup of /etc/sysconfig/ipatbles now and later when you're finished.

So as root type:

iptables -I RH-Firewall-1-INPUT 2 -i usb -j ACCEPT iptables -I FORWARD 1 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -I FORWARD 1 -s 192.168.2.0/24 -j ACCEPT iptables --table nat --append POSTROUTING --out-interface eth0 -s 192.168.2.0/24 -j MASQUERADE /etc/init.d/iptables save
This will allow all connectivity in from the usb interface allowing the n800 to send packets into the fedora box whilst the firewall is running, it will also NAT any traffic from the usb network hiding the n800 behind fedora so that you get onward connectivity. To get the NAT to work you need to enable ip forwarding, this allows fedora to pass pakets between interfaces, to do that type

echo 1 > /proc/sys/net/ipv4/ip_forward

and to get it to survive a reboot update /etc/sysctl.conf with

net.ipv4.ip_forward = 1

The final part is to enable name resolution (DNS), on n800, I updated /etc/resolv.conf with the opendns servers...
nameserver 208.67.222.222 nameserver 208.67.220.220
All things being equal you should now be able to ping www.google.com from your n800 :cool:

To get applications to connect, I found on the latest version of ITOS that the DUMMY IAP didn't work, so I stumbled across this solution.

Create an "ad hoc" wifi connection with static IPs... anything it doesn't matter, and when that's connected in xterm (as root) type ifconfig wlan0 down , you should now be able to connect to the web with your browser / skype etc over your usb network... sweet!

 

 
Nick Bettison ©