HOWTO Perform Bluetooth Dial-Up in Ubuntu

The information on this page is outdated and may not be accurate anymore, since I no longer run Linux and most modern distributions have (admittedly not very good, but built-in) Bluetooth support.

Since I do quite a bit of 3G/HSDPA testing, one of the things that I needed to figure out fairly quickly when I started using Ubuntu 6.10 was how to get Bluetooth dial-up working to access the net through a mobile phone.

The following details my overall experience when setting up a Motorola device on Ubuntu 6.10/Edgy, focusing on the actual Bluetooth setup (if you want to understand how cellular modems/cards work, I have another document on that (it's Mac-oriented, but covers all the basic concepts, and dial-up is dial-up, regardless of operating system).

Let's get to it, then.

Prepare the Bluetooth stack

Besides making sure you have such niceties as hciconfig and rfcomm installed, you need to make sure your Bluetooth hardware is supported by Linux (which is completely outside the scope of these notes) and enabled.

Using Ubuntu 6.10 on a M100, everything worked out of the box, with the notable exception of some flakiness regarding the Bluetooth/Wi-Fi soft key (Fn+F8), which sometimes has to be pressed twice to activate Bluetooth discoverable mode.

Find the Device

This is often the hardest part. Linux is not known for its user-friendliness where it regards Bluetooth setup, and it is notably lacking in terms of device discovery, so in the end I just went with CLI tools.

Yes, setting up gnome-phone-manager lets you breeze through all of this if you're lucky, but I found it flaky and crashy enough to want to do this manually - furthermore, this is basically what it does under the hood.

Also, Bluetooth-enabled mobile phones don't provide an easy way to figure out the MAC address for the device you're interested in.

Basically, what I do is set the phone to discoverable mode and do this:

# sdptool search DUN

I then get a detailed listing of the devices supporting that function (if any), and grab the relevant MAC address.

Define The Serial Port

Once I have the MAC address, I need to bind it to the rfcomm service in the relevant configuration file:

$ cat /etc/bluetooth/rfcomm.conf
rfcomm0 {
       # Automatically bind the device at startup
        bind yes;
       # Bluetooth address of the device
        device 00:19:2C:XX:XX:XX;
       # RFCOMM channel for the connection
        channel 1;
       # Description of the connection
        comment "Motorola";
}

Bluetooth Association

Once the MAC address is known, I bind it to my laptop by setting it to discoverable mode again and using the following commands:

# hcitool cc  00:19:2C:XX:XX:XX
# hcitool auth 00:19:2C:XX:XX:XX

In Ubuntu 6.10, this causes a Gnome dialog box to appear prompting for the Bluetooth PIN, and association then proceeds as normal.

Binding

Now that the association is created, all that's required to activate /dev/rfcomm0 is:

# rfcomm bind all

You can then use /dev/rfcomm0 as the modem device for connecting to the Internet.


See Also: