BlackBerry over Bluetooth

BlackBerry's support the Bluetooth DUN profile which enables tethering to a laptop for accessing the internet over a mobile broadband connection. Tethering is a simple process by which the rfcommm bluetooth host creates a PPP connection to the BlackBerry allowing internet access.

Configuration for this HOWTO
The following items are the configuration used to test the steps, and hardware/software/kernel requirements in order to get tethering working.


 * Tested on host computer: Dell Inspiron Mini laptop, with the Broadcom BCM2046 bluetooth device using the hci_usb driver. Any bluetooth controller should work.
 * Tested with phone: BlackBerry 9000 Bold on AT&T wireless, with the unlimited internet/tethering package. Most carriers don't lock down bluetooth, so you should have success with most.  You simply need to know the PPP connection parameters (dial out number, user, password) for your carrier.  Other blackberry models should work.  In fact, any GPRS-enabled phone with bluetooth (and the DUN profile) should work with minor tweaks.
 * Tested on kernel: 2.6.25-gentoo-r7 (SMP, PREEMPT) Any 2.6 kernel should work
 * Tested on bluetooth stack: bluez-utils 2.25-r1, bluez-libs 2.25; Bluez-3* was problematic, so you should stick to 2 for now
 * Required kernel options: You must have support for ppp, and optionally, compression. Of course, you need bluetooth support, and that's covered in the Gentoo bluetooth guide.  In addition to basic bluetooth support, rfcomm support must be enabled.  Here are the settings (they can be modular or compiled in, it's up to you):

Requirements

 * A BlackBerry with bluetooth enabled, and the DUN profile enabled (see below on how to enable these).
 * A Gentoo computer with bluetooth support
 * Highly Recommended: An unlimited internet package from your cellular provider. Otherwise, you will be paying an arm and a leg to use this service.

Configuring your BlackBerry
First, we need to enable BlueTooth on the BlackBerry. This may not be possible if the blackberry uses Blackberry Enterprise services and bluetooth is disabled via a security policy. To configure bluetooth for DUN:


 * 1) Select the Setup folder from the Home menu
 * 2) Open the connections application.  You should see Bluetooth listed as one of the connections.  If it's not, then it's disabled.  To enable it, go into bluetooth configuration (next step) and enable it on the options screen.
 * 3) Open the bluetooth setup application.  If it's not in the setup folder, you or a theme moved it, so you'll have to find it.  It may prompt you with options for search, listen, or cancel.  If so, choose cancel.
 * 4) Hit the blackberry button and select the Options item from the menu
 * 5) Near the bottom is "Services". Various bluetooth profiles can be enabled and disabled here.  Scroll to "Dial-up networking" and ensure it's checked.
 * 6) Optionally, select "Yes" to "Connect on Power Up".  It's a slight security risk, but you won't have to manually enable bluetooth every time you boot.
 * 7) Save the settings (blackberry button, select Save from the menu).

Your BlackBerry is now configured for bluetooth PPP DUN!

Configuring your Bluetooth host
This section explains how to configure your Gentoo box for tethering.

Installing the userspace Bluez bluetooth stack
After installing bluez-utils and configuring it for your card, including setting a PIN, you will need to configure rfcomm to bind to the BlackBerry.

This guide won't go over configuring bluetooth since there are many guides that do that, including the offical Gentoo Bluetooth Guide.

[[=== Setting up comunication between the devices ===

Go back to bluetooth setup on your blackberry, and when the Search/Listen/Cancel menu comes up, choose Listen. This puts the device in pairing mode.

Pairing
On the host (the computer that will connect to the BlackBerry), run

The output will return a MAC address and device name. Now, you need to pair the devices.

To pair, run

where the MAC is the MAC of the blackberry. If all is successful, the blackberry will open a prompt for the passkey. Enter the pin from /etc/bluetooth/pin (or wherever if you're using a third party pin-helper)

If pairing is successful, you should see the name of the bluetooth host (your computer) in the devices list on the blackberry. Additionally, it will be in bold if the connection is successful. Note that hcitool may have trouble connecting due to bugs in either bluez or the blackberry BT stack. This is not a problem.

Configuring rfcomm.conf
Now that the blackberry is paired, we need to configure rfcomm (basically, a bluetooth serial port) for the blackberry. The rfcomm information is stored in /etc/bluetooth/rfcomm.conf. If you have other rfcomm devices, you can select a different node. The example below uses rfcomm0. To get the channel to use, run

The results should include a service descriptor that looks like the following. Note the channel number: Service Name: Dialup Networking Service RecHandle: 0x10000 Service Class ID List: "Dialup Networking" (0x1103) "Generic Networking" (0x1201) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 1 Profile Descriptor List: "Dialup Networking" (0x1103) Version: 0x0100 This tells you that DUN is on Channel 1.

Now, you're ready to modify the rfcomm.conf

Installing/Configuring PPP
After saving this file, the next step is to install and setup ppp. To do this, run

After ppp is installed, it needs to be configured for the rfcomm DUN connection. There are three pieces to this:


 * 1) The chat script for instantiating the connection
 * 2) The /etc/conf.d/net changes for starting the ppp network device
 * 3) Optionally, using a chap-secrets file to semi-securely store the password for the ppp connection.  It's only "semi-secure" because the password will be in plain text, but the file is only accessible by root.

Creating a chat script
First, ppp needs to know what commands to send to the blackberry to create a connection. The rfcomm/DUN connection behaves as an AT modem, so a chat script needs to be written to initialize the modem and "dial" a connection. For simplicity's sake, the chat script can be placed in /etc/ppp. The chat script for the blackberry is as follows.

Configuring login information
A PPP connection requires a username and password to be sent. Some carriers, including AT&T, use a universal login/password, which is basically a dummy login since the PPP protocol requires authentication. Others may require credentials specific to you. To prevent prying eyes from seeing your credentials, if they're user-specific, you'll want to put them in your chap-secrets file. Alternately, they can be placed directly in /etc/conf.d/net, which is no problem if the credentials are a "dummy" username/password combo, but is a security risk if the information is specific.

To place your credentials in the chap-secrets file, simply add the line: MyUserName * password123 to /etc/ppp/chap-secrets, replacing the MyUserName and password123 with the appropriate values. For example, for AT&T, the chap-secrets file should look like:

As you can see, this is a sort of universal login.

If you have a universal login like the one above, you can bypass chap-secrets altogether and place the information directly in the /etc/conf.d/net file.

Configuring Gentoo networking
First, you need to create a net.ppp# symlink to net.lo in /etc/init.d/. You don't have to use net.ppp0 if you have other ppp connections, you can use whatever you want. This example uses net.ppp2 since the author is lazy and cut-and-paste most of this from his own conf files. To do this, running the following commands as root:

where the "ppp2" part is whichever ppp connection you want to use.

Now, you need to add the configuration information to the /etc/conf.d/net. You will specify how to connect (using the chat program), various options controlling ppp's behavior, the device to use (rfcomm0), and optionally, a username/password (or specify just the username and have it looked up in the chap-secrets file).

The net configuration for the ppp connection is as follows (the options assume the connection is named ppp2:

Testing/Starting the connection
Ensure that bluetooth is enabled on your blackberry, and ensure that the bluetooth daemon is started on the host:

Now, simply start the connection like any other network connection:

After a few seconds, check the connection:

The output should be something like the following: ppp2     Link encap:Point-to-Point Protocol inet addr:166.217.210.244 P-t-P:169.254.1.1  Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500  Metric:1 RX packets:1822 errors:0 dropped:0 overruns:0 frame:0 TX packets:1948 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:1495909 (1.4 Mb) TX bytes:445437 (434.9 K with fewer packets, of course.  This means your tether is successful!

Extending to other GPRS-enabled phones
If you don't have a blackberry, but have another GPRS-enabled phone with bluetooth (including the bluetooth DUN profile), you should be able to follow this guide almost verbatim except for the part involving the chat-gprs-att script. The chat script not only instantiates the ppp connection, but it also configures the phone to accept connections. Different phones have different initialization requirements, so you should google you phone model with the words "tether linux" and you'll probably stumble upon a working chat script.

USB Tethering (BlackBerry or other phone)
If the blackberry/phone doesn't have bluetooth, or it's disabled or crippled, or you would rather use a wired connection between the phone and laptop, and the phone has a USB connection, then you may be able to tether over that. Some phones (e.g., the Razr V3xx) give you an option on what to do when USB is connected, such as file transfer mode, communications mode, etc. If you select the communications mode, and connect it to your gentoo box, you can tether over that. You will need to add the cdc_acm kernel module in the USB device drivers section, and replace the rfcomm0 with ttyACM0 where necessary, but otherwise, everything else should stay the same.

More on blackberry USB The barry /etc/ppp/peers/ connection scripts, or on some installs /etc/chatscripts/ is not installed by portage(this could be why its masked in portage). Run ACCEPT_KEYWORDS="~x86" emerge -f barry Decompress the bzip in ur distfile directory with tar -jxvf barry-blah.tar.bz2, and cd to the barry/ppp/ dir and move the connection scripts. Blackberry 8900 with Barry over usb via /dev/pts/5 using pppob(barry-utils) works perfect im writing this update using it with barry v0.16 through T-mobile out the box with barry, T-mobile customers username is thier phone number area code included or thier weblogin name, with thier online weblogin password.

Extending to other flavors of Linux
Since you may have stumbled upon this via Google, it makes sense to explain shortly how to configure the ppp scripts for flavors of linux without the nice /etc/conf.d/net interface. Basically, if you look at the pppd_ppp2 section in the /etc/conf.d/net file, you'll notice that this looks very similar to a /etc/ppp/peers/options.* file. That's because it is. To bypass the whole /etc/conf.d/net thing, create a file called /etc/ppp/options.GPRS. Put everything except the "user" line from the /etc/conf.d/net example in that file. Thus, the file should look like this (comments are stripped, see above for what the options mean.

Then, create a file called /etc/ppp/peers/GPRS. This file should look as follows:

Then, to connect, run the following command as root:

You should see a bunch of output about negotiating the connection, etc., depending on how much debugging you turn on. pppd will take the next available ppp interface, so unlike the gentoo method, the ppp interface number is not static.

If you have trouble connecting, follow the instructions below on debuggging.

Debugging the connection
If no IP (inet addr) is available, wait a few seconds and try again. If you get: ppp2: error fetching interface information: Device not found Then there's something wrong with the configuration. The first step in debugging is increasing the verbosity of what the connection sends to the system log. To do this, in the file /etc/conf.d/net, replace the line "debug" with "debug debug debug" Then add the verbose switch to the connect line, so replace "connect \"/usr/sbin/chat -f /etc/ppp/chat-gprs-att -t3 -r /dev/console\"" with "connect \"/usr/sbin/chat -v -f /etc/ppp/chat-gprs-att -t3 -r /dev/console\"" Now, restart the service:

The detail provided by pppd to syslog will be much higher, and you should be able to see a line-by-line log of what pppd is doing. Before doing the restart (or immediately after, since it backgrounds itself), you may want to tail -f the appropriate log file to see the pppd output in realtime. Using metalog, for example:

This HOWTO will not go in to all the possible errors, to find out what the problem is, you can google the last few lines of the pppd output and see what comes up (that's how this configuration was determined, trial and error, followed by googling the error)