Sharing internet with Nokia 770 over bluetooth
Nov 13th, 2005 by RealNitro
It’s been a (very) long time since I have posted here (again), but I bought myself a Nokia 770 last week, and it took me a lot of time to get it on the net, so I thought I’d share how I got it to work.
First off, some interesting links:
- Host to host bluetooth on the gentoo wiki
- Enable root access on the maemo wiki
- Bluetooth networking howto on the Maemo wiki
- X Terminal for the Nokia 770
- IP Masquerade howto
You need to have your bluetooth stick working first. Gentoo users should read the first parts of the host to host bluetooth howto, other distro’s should consult the proper information on the community forums/wiki. (Don’t scan for other devices yet, just setup your kernel and BlueZ.)
Then open the X Terminal on your 770 and be root. Enter:
hcitool scan
The scan should display your pc’s bluetooth name and its bluetooth ID. If the scan cannot find your computer, check again if your bluetooth stick is really working. Scanning for your 770 on your computer is no use, since your 770 will remain invisible. Now let’s pair your 770 with the pc. Execute the following on your 770, but replace 00:10:20:30:40:50 with your computer’s Bluetooth ID:
hcitool cc 00:10:20:30:40:50
If you get an error, try:
rm /etc/bluetooth/link_key
If the pairing works, you will be asked to enter the PIN code of your pc. There is no need to try to connect from your pc to your 770, it will not work anyway (your pc cannot see your 770, remember). Next, make your computer listen for an incoming (network) connection. As root execute:
pand --listen --role NAP
Now, on your 770, connect to your pc:
pand --connect 00:10:20:30:40:50
(Replace 00:10:20:30:40:50 with your pc’s Bluetooth ID again.)
If the connection has been set up, the following command should work on your 770:
ifconfig bnep0 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255
Warning: if your local network already uses the 192.168.2.* subnet, replace the IP with another one that isn’t in a subnet your pc is a part of!
On your pc, execute the same command, but change the IP:
ifconfig bnep0 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
We’re almost there now. Your 770 and your pc are part of the same subnet now! Let’s try to ping the 770. On your pc:
ping 192.168.2.2
If you installed the ssh server, you can run it now, and log into it from your pc.
Now, let’s set up the internet connection forwarding. First off, let your 770 know that your pc is its gateway to the internet:
route add default gw 192.168.2.1
Also add a dummy internet connection:
gconftool -s -t string /system/osso/connectivity/IAP/DEFAULT/type DUMMY
On your pc, display the content of /etc/resolv.conf:
cat /etc/resolv.conf
And add the rules to the /etc/resolv.conf file on your 770. For each line do:
echo "line" >> /etc/resolv.conf
All that’s left to do is making your pc act as a router for your 770. One way to do that (not the easiest one), is to use a program called iptables. In this howto I will explain how to setup iptables on gentoo. Again, if you use an other distro, check the community forums and/or wiki. On gentoo, emerge iptables. You might have to recompile your kernel, just follow the ‘Kernel Support’ chapter of this howto on the gentoo wiki. To configure iptables, you can read this guide, or, if you just want a quick solution, use this script. As root, paste it inside a file. Then comment out IPTABLES=/usr/local/sbin/iptables, and uncomment #IPTABLES=/sbin/iptables. Change INTIF=”eth1″ to INTIF=”bnep0″. You might have to change EXTIF=”eth0″ too. (I had to change it to vpnlink because I connect to the internet with a vpn.) When you finished changing the script, make it executable, and run it. There should be no errors. Now save the script:
/etc/init.d/iptables save
and start iptables:
/etc/init.d/iptables start
If you want to start iptables everytime you boot, do:
rc-update add iptables default
You should be able to surf with your 770 now! I plan on writing a few script to make the linking more automatic. Plz share your comments here, and post any mistakes in the howto.

Thanks for the gconf key, I assume this will solve the issue of apps trying to connect when there is already usbnet link.
Nice to find a solution before investigating the problem
Remote X sessions on Nokia 770
The exploration of the Nokia 770 as a remote device has begun.
…
Ok, I installed Ubuntu Linux on my parents computer (they don’t know yet :-), and I followed my own tutorial. It took me only 4 minutes to set up a connection! I just plugged my usb bluetooth key in, and Ubuntu recognised it immediately. Note that I didn’t set up any internet forwarding, just a connection.
Hi,
I am also planning to order a Nokia 770, … in fact, it’s planned for mid December since I will be my Christmas present in fact.
A few questions :
- do you speak Dutch (I assume, since you have a .be url) ?
- what’s your first impression of the Nokia 770
- what’s your impression after the use of it during a number of days, weeks
Finally, can you recommend it ?
Thanks in advance, Jan
@Jan (in dutch
Ja, ik spreek Nederlands.
Ik moet toegeven dat ik getwijfeld heb om een N770 te kopen. 369
Um, this is great. Bit trickier than I’m inclined to handle, I’m afraid.
Have you got scripts written yet?
Is there any way to do this without being root?
Thanks,
Roger
I don’t think it can be done without being root. (If you do not want to log in as root just to start the connection, try writing a little script and switch the superuser bit on with ‘chmod +s script.sh’. I do have some scripts, but they’re just the commands I posted here, put inside a little text file. If I’d have the time, I’d write some more advanced scripts, but I’m really, really busy atm. I’m planning to create a .desktop file that can be added to the menu some time, but don’t expect it before Christmas (probably not even before february — exams :-).
I’m patient.
(After all, I waited all this time for the 770.)
Anyway, I don’t have a USB Bluetooth adapter now, just looking into it. Maybe my finances will have recovered by February.
Optimal web surfing on the Nokia 770
OK, we’ve all been surfing the web for years (more than a decade for some). So what’s there to learn about surfing using the Nokia 770? Lots.
…
Hi, does this work on firmware 2005/51 and upwards? Device bnep0 doesn’t seem to exist - I get SIOCSIFADR/FNETMASK/FBRDADDR errors with the ifconfig command.
I didn’t install that firmware yet. You could search for the bnep0 device by executing ‘ifconfig’ without any arguments. That will display information about all active network devices, including bnep0 (or something similar).
If you are getting SIOCSIFADR/FNETMASK/FBRDADDR errors when trying to add the bnep0 network device, then chances are you did not run the
pand –listen –role NAP
as root.
A working iptables script (works on gentoo):
—————————
#!/bin/bash
IPTABLES=’/sbin/iptables’
# Set interface values
EXTIF=’eth0′
INTIF1=’bnep0′
# enable ip forwarding in the kernel
/bin/echo 1 > /proc/sys/net/ipv4/ip_forward
# flush rules and delete chains
$IPTABLES -F
$IPTABLES -X
# enable masquerading to allow LAN internet access
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
# forward LAN traffic from $INTIF1 to Internet interface $EXTIF
$IPTABLES -A FORWARD -i $INTIF1 -o $EXTIF -m state –state NEW,ESTABLISHED -j ACCEPT
Just found your site tonight. Nice work, although I couldn’t get it to work. I added the application catalog url shown but application manager said it couldn’t find any packages there. So I tried the manual method– ncurses lib installed just fine but the others claim to be incompatible. I have the 2006 os and selected the appropriate packages.
Just letting you know. Man, I sure had high hopes!
Texrat, this howto was written for os 2005. I haven’t tested it with os 2006. I’ll probably update this howto when I get around to trying it myself on os 2006.