2011/12/10

Nokia N900 as USB WiFi router

Update:
If you want to use just 3G then you might be better with Mobile Hotspot.

Here's how to share your N900 WLAN connection through USB-port.

First, you'll need kernel-power, usb-networking-modules, rootsh and udhcpd packages installed to make this work. Once installed, open up terminal and create file routerup.sh with the following content:

#!/bin/sh
ifup usb0
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A POSTROUTING -t nat -s 192.168.2.0/24 -j MASQUERADE
iptables -I INPUT -s 192.168.2.0/24 -j ACCEPT
iptables -P FORWARD ACCEPT
udhcpd

Next, make routerup.sh executable

chmod ugo+x routerup.sh

Now, create file /etc/udhcpd.conf with following content:

start 192.168.2.20
end 192.168.2.30
interface usb0
opt router 192.168.2.15
opt dns 8.8.8.8 8.8.4.4


Create routerdown.sh

#!/bin/sh
killall udhcpd
ifdown usb0
echo 0 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -t nat -F



and make it executable too.

You can use these scripts manually by plugging USB-cord (choose PC Suite mode) and then executing routerup.sh (and routerdown.sh when you're done) as root. Scripts wont work as normal user. Any modern linux system should now be able to get ip from N900 dhcp-server and have network.

If you need this connectivity often, you can put routerup.sh into N900's /usr/sbin/pcsuite-enable.sh before last line which reads exit 0, and routerdown.sh to /usr/sbin/pcsuite-disable.sh to use scripts automatically on PC Suite connection.

Windows users need  http://tablets-dev.nokia.com/MADDE.php to make this work, can't write more specific instructions because the lack of windows ;)

Post a Comment