Bluetooth tethering with blues-tools and Cyanogenmod
I have to admit that I kind of like Bluetooth technology. It works great for a wireless mouse, and I also use it to tether my Android phone which is running Cyanogenmod 7.2. Here is how.
First, we need to pair the devices, the process which I have already described. To recap:
Here I’ve chosen “desire” as an alias for my phone (it’s an HTC
Desire). Once the devices are paired, the rest is easy. The important
command is bt-network -c <alias> nap
. I’ve written a small script to
wait for bluetooth connection and to launch dhcp client once it is
established:
Here is the normal output of the script:
$ ./bt-tether.sh
*** Waiting for bluetooth connection...1 2 3 4
*** Bluetooth connection established:
Network service is connected
Interface: bnep0
UUID: NAP (00001116-0000-1000-8000-00805f9b34fb)
*** Running dhcp client:
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/bnep0/cc:af:78:e4:e3:ef
Sending on LPF/bnep0/cc:af:78:e4:e3:ef
Sending on Socket/fallback
DHCPREQUEST on bnep0 to 255.255.255.255 port 67
DHCPACK from 192.168.43.1
bound to 192.168.43.78 -- renewal in 1520 seconds.
And here is the notification that appears on the phone screen once the connection is established:
Update 11 May 2013
I recently realized that, at least on a Debian system, the shell script above is not really necessary.
Instead, add the following 2 lines to the /etc/network/interfaces
file:
allow-hotplug bnep0
iface bnep0 inet dhcp
To start the tethering, simply use the bt-network
command directly:
bt-network -c <alias> nap
As soon as the bluetooth network interface bnep0
appears, it will be
auto-configured with dhcp thanks to the entry in the
/etc/network/interfaces
file.