Pairing a cellphone with Ubuntu via Bluetooth

If you want to use a GPRS-capable Nokia cellphone as a modem via Bluetooth, you'll need to pair the cellphone with your computer. The pairing will then establish the cellphone as an RF communications port, after which you can connect to the Internet by setting a PPP connection.

These steps will show you how to establish that pairing.

Step 1. Bluetooth Hardware
First, do you have a Bluetooth device on your computer? If you're running a high-end desktop or notebook, the likelihood is high (otherwise you've paid too much). Unfortunately for me, I have had to go out and buy a cheap Bluetooth dongle from my friendly neighborhood CD-R King.

Plug in the Bluetooth dongle into a USB port. Was the dongle recognized? Run lsusb to find out. Here's my sample output:

Bus 002 Device 002: ID 1131:1001 Integrated System Solution Corp. KY-BT100 Bluetooth Adapter

Step 2. Load Bluetooth Drivers
You'll need to install Bluetooth utilities for Ubuntu.

To install the Bluetooth utilities,

sudo apt-get install bluez-utils


Step 3. Detect the phone
Now, try to detect the phone from Ubuntu.

First, turn on Bluetooth services on the cellphone. On a Nokia, follow the following sequence: Menu->Settings->Connectivity->Bluetooth. Turn on Bluetooth and make sure the the visibility is Shown to all.

Then, run hcitool scan. Sample output is:

Scanning ...
00:17:B0:B4:52:C8 Nokia6233


The six octet number (00:17:B0:B4:52:C8) is my cellphone's unique ID. Yours will be different.

Step 4. Change hcid.conf security option
You'll have to change the default Bluetooth configuration of Ubuntu, specifically the section pertaining to security. Ordinarily, you shouldn't need to go through this step if the security configuration was set properly. (I speak for the case of Edgy; this may change in future versions.)

Edit /etc/bluetooth/hcid.conf (you will need to go sudo for this). Change the line:

security user;

to

security auto;

and restart Bluetooth services by running sudo /etc/init.d/bluetooth restart.

By the way, hcid stands for Bluetooth Host Controller Interface demon. /etc/bluetooth/hcid.conf contains all the options needed by the daemon. It consists of sections and parameters for pairing, security, and others.


Step 5. Pair the phone
Finally, the pairing!

Go back to the Bluetooth menu of your cellphone and activate the pairing. On the Nokia 6233, the sequence is Menu->Settings->Connectivity->Bluetooth->Paired Devices. Click on New. The phone will then search for Devices, after which the hostname of your Ubuntu machine should appear.

Select Pair. You will be prompted for a passcode. The passcode number is as given in /etc/bluetooth/hcid.conf. The default is 1234.

You will have the option to let the computer connect automatically to the phone. Choose "Yes" if this will a more or less permanent connection; choose "No" if this is only temporary or if you want the security of confirmation.

And you're all set!