BNEP PAN Connections with BlueZ 4.x

When Ubuntu adopted BlueZ 4.x as its Bluetooth suite of choice a lot of things broke, especially if you were doing more than just connecting to your phone. Unfortunately for us, we were doing a lot more than that. This mean that under Intrepid we had to force a downgrade to the Hardy version of BlueZ (3.26/3.29), an option which vanished with Jaunty as the package installation threw errors.

Despite a lot of discussion of this issue, it seems to be quite hard to find a real solution where someone has said “install this, tweak this, that’ll fix it for you”. However, today I successfully created a PAN network between my desktop and a Gumstix device using BlueZ 4.x, and here’s how I did it.

Note that there is some configuration needed on the Gumstix side which is not covered here and will be the subject of a future post.

First, you need to add the Blueman PPA repository and GPG key to your software sources list. You can do this the graphical way as described on the website, or run the following commands:

sudo apt-key adv --keyserver --recv-keys 951DC1E2
echo 'deb jaunty main' | sudo tee -a /etc/apt/sources.list
echo 'deb-src jaunty main' | sudo tee -a /etc/apt/sources.list

Then you update your package list and install Blueman:

sudo apt-get update
sudo apt-get install blueman dhcp3-server

We install dhcp3-server so that the option is there to hand out IP addresses to clients on the PAN (the subject of another post). There is another method presented by Blueman, but I know nothing about that one, so I can’t advise.

At this point you’ll want to log out and back in to make sure you have the Blueman applet running. Right-click on the Bluetooth icon (near the clock towards the right-hand side of the top panel with the default GNOME configuration, but usually only if you have Bluetooth hardware available). Click on Local Services, select Network, enable Network Access Point (NAP), select dhcpd3 as the DHCP server type, and enter the IP address you want to use for this machine. It should look like the screenshot below:


I have selected to let Blueman handle my connection because I don’t trust NetworkManager, you should be able to use whatever you’re happy with.

Now you just need to pair the Gumstix and your PC. As BlueZ 4.x enforces the use of PINs much more than 3.x did, you’ll need to add a boot script to your Gumstix (a symlink in /etc/rc5.d/ to a script in /etc/init.d/) with following contents:

passkey-agent --default 0000 &

Replace 0000 with your desired PIN. Additionally, you’ll want to edit /etc/bluetooth/hcid.conf (also on the Gumstix device) to use the same PIN and set security to auto. One of these is used for incoming connections and one for outgoing. At this point you can either restart Bluetooth and run passkey-agent (or the startup script) manually, or you can just reboot the Gumstix device. I’d suggest the latter.

Next, left-click the Bluetooth icon on your PC to open the devices list. Click the search button and then right-click your Gumstix, click Add Device, then right-click again and select Bond. It should ask for the PIN at this stage, use the one you selected earlier. Now you can use pand on the Gumstix to connect to the PC and you should be asked for the PIN one last time, followed by a popup asking if you want to allow a BNEP connection. Test the connection by pinging the Gumstix device, but remember that STP is active on the bridge that Blueman creates, so there will be a delay before the ping attempts start to succeed.

As if by magic, a working PAN connection using BlueZ 4.x. Related future topics for posts will be:

For those of you wanting to use your phone with Ubuntu and BlueZ 4.x, check out this.

Loading Facebook Comments ...
  1. […] to several flaws with the configuration given below. For now, the setup of a BNEP PAN is detailed here, dealing with configuration on the PC side, as well as some configuration on the Gumstix […]

  2. […] this case, the bridge is called (unimaginatively) bridge0. Note that if you followed my previous instructions for setting up BNEP PAN networks under BlueZ 4.x, Blueman actually forms a bridge behind the scenes […]

  3. […] of a small Gumstix network (assuming you have set up bridging previously, either manually or via Blueman), you want to change the line to read INTERFACES="pan0". Your bridge may be pan1 or some other […]