Bluetooth accesspoint with Debian GNU/Linux


Visit the sponsor: the little tank that could

With a cheap USB bluetooth dongle, you can make your computer act as a bluetooth access point. It is best to get a class 1 device, which will give at least a range of 100 meters unobscured, and will go through 1 or 2 concrete walls or ceilings. Setting it up under Debian, or any other distro is not trivial. As this took me a while, I decided to document the process.

When you use Bluetooth for network services (as opposed to wireless microphone, wiresless mouse, etc), you are using its PAN, or Personal Area Network profile. PAN is provied by the PAN daemon, pand, from the bluez-utils package. PAN uses the BNEP protocol. BNEP stands for Bluetooth Network Encapsulation Protocol.

Kernel configuration

Get a recent 2.6.x kernel, and enable the following features, either as module or built-in:

Debian packages

Install the following Debian packages:

Configuration files

Operation

First check, whether your USB dongle has been detected by the kernel. You can check this by running 'hciconfig -a'. You should get information on the hci0 interface. Now, if a client bluetooth device will request network service, the PAN daemon, pand, will respond to this. Check your process list to see if pand is running. If not, '/etc/init.d/bluez-utils start' is required. Once the two bluetooth devices connect, a network device called 'bnep0' is created, and pand will execute the /etc/bluetooth/pan/dev-up script. In this script, we will bridge the newly created bnep0 to eth0, using the bridge called br0. To kill the connection at either side, run 'pand -K'.

Clients

A linux client for the bluetooth network, can connect to the server by using this command:
    pand --nodetach --role PANU --search
  
UPDATE: I've found that I need to have 'dbus' installed to get rid of the error "Inquiry failed. No such device" I recently experienced. Without dbus, /etc/init.d/bluetooth would fail.

Notes

Don't forget that your dhcpd server should now listen on the bridge br0, not on the LAN eth0. Edit /etc/init.d/dhcpd to change this.

The whole deal with the bridging is required, so that dhcpd can function regardless wether bnep0 exists or not. You cannot bring up dhcpd to listen on bnep0, if there is no bluetooth PAN connection. You can, however, have dhcpd listen on the br0 bridge, and attach it to bnep0 whenever a bluetooth client connects.

If you experience troubles, check the /var/log/daemon.log file for more information.

References