Archive for: June, 2006

Cellphone as a bluetooth modem with Linux

Jun 28 2006 Published by under Linux,Networking

Many cellphones today have the ability to work as data modems for computers. Using bluetooth for this purpose is the easiest way, as it does not require any cellphone specific drivers and works with any operating system.

For this to work you need bluetooth support in kernel and all the necessary drivers and software. In this case I used a generic USB dongle which works with the built in kernel driver so the kernel config includes:


Many recent precompiled kernels supplied by various distributions, already have these options selected. The installed software includes: bluetooth bluez-pin bluez-utils bluez-firmware. Turn on bluetooth on both devices and run:

hcitool dev

To make sure your adapter is recognized. If not, you need to fix it before continueing.

Make sure your phone is set to be “always visible”, so that your pc could find it. Launch a program on the pc to scan for bluetooth devices and their services. What we need to know is the channel used for DUN profile. In my case it was 4. There are numerous graphical tools for getting information about bluetooth devices and their services, but I will not cover them as they are usually different for different window managers and essentially, they are just front-ends for hcitool and sdptool, which I describe below. To find out channel number run:

sdptool search --bdaddr 11:22:33:44:55:66 DUN

Here instead of “11:22:33:44:55:66″ write your phone’s MAC address, which often can be found from the device info on the phone itself or by running:

hcitool scan

It should show you the address and name of your phone. Consult the respected manual pages for more options and parameters, if you are curious. Then correct the config files:

in /etc/bluetooth/hcid.conf make sure that it reads:

auth enable;
encrypt enable;

in /etc/bluetooth/rfcomm.conf set:

rfcomm0 {
    bind yes;
    device 11:22:33:44:55:66;
    channel 4;
    comment "Bluetooth Modem";

Again, write your phone’s MAC address instead of “11:22:33:44:55:66″. Channel is exactly what we found in the first step. Now you need to set up pin for pairing:

echo 123456 > /etc/bluetooth/pin

Instead of “123456″ you can put any string of integers. This will be your pin. Restart the bluetooth services on the pc.

/etc/init.d/bluetooth restart

Search for your pc in the phone’s bluetooth ap. Ask to pair. When it asks a pin, enter the number from /etc/bluetooth/pin. Any applicable LEDs on your bluetooth adapter should be blinking while it authenticates.

Assuming everything went smooth, just configure your wvdial:

[Dialer bt]
Modem = /dev/rfcomm0
Phone = #777
Baud = 115200
Stupid Mode = on
Init1 = ATZ
Username = phone
Password = phone
Carrier Check = no
Abort on No Dialtone = off
FlowControl = Hardware (CRTSCTS)

Then run

wvdial bt

That should do the trick. The phone number to dial does matter, but the username/password do not. #777 is the number used by Bell Mobility and Sprint. Others may or may not be the same. In fact, if you have an existing dial-up account with some other ISP, you can try accessing that instead, putting the correct number, username and password. That way you will be charged not for data use, but for regular airtime by your cellphone provider.

If you get errors about not being able to access the device /dev/rfcomm0, your pairing wasn’t successful. Try to initialize pairing from the pc side:

hcitool auth addr

Where addr is your phone’s MAC address. You should see a prompt on the phone’s screen asking you for pin. Enter the same pin you set up in /etc/bluetooth/pin.

Afterwards the only thing you would need to do is launch wvdial bt whenever you need to connect.


This howto is based on the Guru Labs Guide with some generalizations and modifications. It should work with any cell phone that supports Bluetooth Dial-Up Networking profile and any Linux distibution. Tested using Debian with Samsung A920 on Bell Mobility network.

No responses yet

« Newer posts