Thursday, February 18, 2010

Tethering a BlackBerry with a Linux based system via bluetooth

I tether my BlackBerry Pearl 8130 to my apple ibook g4, which runs Debian Linux, using bluetooth. My provider is U.S. Cellular. The following should work using any modern debian based distro and perhaps using a perhaps any phone that supports dial up networking via bluetooth (not just a blackberry).

You will need a bluetooth adapter that is recognized by the kernel of your distro, a working bluetooth stack, and a tethering plan from your provider. also, very recommended are the tools sdptool and hcitool, both of which are provided by the bluez-utils package in Debian (and probably Ubuntu), and also pppconfig - more on this one a little later.

First things first, you need the hardware address of your phones bluetooth adapter, which can be found running hcitool scan. It will look something like:

user@linux:~$ hcitool scan
Scanning ...
00:24:7A:7A:48:F7 phone


The second vital piece of info you need is the channel your phone uses for its dial up connection. This is achieved using the sdptool command:

user@linux:~$ sdptool browse 00:24:7A:7A:48:F7 | less

Piping through less makes it easier to read. Using the down/up key, look for part labled "Service Name: Dialup Networking", underneath this it will tell you what channel it uses. The next step is to modify the rfcomm.conf file, which is located in /etc/bluetooth/rfcomm.conf. Mine looks like:

rfcomm0 {
bind yes;
device 00:24:7A:7A:48:F7;
channel 3;
}



You can actually get the gnome network manager to manage your dialup connections as well as wifi or ethernet. to do this, use the pppconfig tool to enter your dialout number and username. Configured, mine looks like:

One oddity is that it doesn't show my device, which for me is /dev/rfcomm0. At this point, you should be able to dial out, using the pppd command:

user@linux:~$ sudo pppd call 3G_Wireless

To use the GUI to dial out, I let the gnome network manager manage dialout/hang up this device. This is done by adding something like:

iface ppp0 inet ppp
provider 3G_Wireless

into your /etc/network/interfaces, where 3G_Wireless is the name of the connection you created in the pppconfig utility.