digressions from meandering


Tethering Nokia N900 to Macbook using Bluetooth PAN 1-Jun-2011 11:19 PM

First, I tried wifi. Joikuspot has a nice UI, successfully drains battery and fries phone and everything in contact therewith. Unfortunately, most of the time the success is limited to the aforementioned achievements. Mobilehotspot's success is pretty much limited to Joikuspot's one with the exception of cool UI and addition of succeeding in making me install the power kernel. So, I thought I'd rather look elsewhere.

Then, I tried Bluetooth DUN. It's easy and it works. But then you're forced to chose between computer and phone. So, I thought I'd see into other options.

And I only knew of one (USB being too wiresome), which is Bluetooth PAN. Having iptables-enabled kernel already (thanks to mobile hotspot), that really seemed to be an option. And actually turned out to be one. So I better write down the steps I took in case I'll have to reproduce it.

First, I went into /etc/bluetooth/main.conf and removed network from DisabledPlugins option value. Actually, on a second thought I've just commented out the line. I don't know when bluetoothd rereads the configuration file, so I SIGHUPed it.

Then, in Mac's system preferences, I dived into bluetooth part and updated device services for N900. Then I jumped into network part of system preferences, created Bluetooth PAN interface for the device and in advanced section specified manually 192.168.15.15 ip address with 192.168.15.19 router (don't ask why these numbers, they are just cool and if you're going to follow me, use your imagination!)

Then I went back to Nokia shell and added configuration to /etc/network/interfaces:

auto bnep0
iface bnep0 inet static
        address 192.168.15.19
        netmask 255.255.255.0
        pre-up sh -c "/usr/sbin/iptables -t nat -F ; /usr/sbin/iptables -t nat -A POSTROUTING -s 192.168.15.0/24 ! -d 192.168.15.0/24 -j MASQUERADE ; echo 1 >/proc/sys/net/ipv4/ip_forward"

And found out that for whatever reason it's not run. Instead of figuring this out I've just forced it by creating a /etc/udev/rules.d/50-bnep.rules file:

KERNEL=="bnep0", ACTION=="add", RUN+="/bin/sh -c '/sbin/ifup -f %k'"
KERNEL=="bnep0", ACTION=="remove", RUN+="/bin/sh -c '/sbin/ifdown -f %k'"

Now when I want to access internet via Nokia, I turn bluetooth on, select 'Connect to Network' for Nokia from my Mac's bluetooth menu, and make sure phone itself is connected to the net.

If you can read this, it works for me. It probably won't work for you and you don't care, because most likely you have no N900, anyway.

This page is a work of fiction and is intended to be viewed for depression purpose only. All characters and incidents mentioned or not are fictional, any resemblance to the actual companies, incidents, or persons living or dead is unintended and purely coincidental. Note: This disclaimer is also fictitious.
Michael Krelin
Munich, Germany
born on the 28th of February
 
 subscribe