Bluetooth and the p990i PAN and Ubuntu or Debian

Install bluez-utils

Find your phone

sudo hcitool scan

Get the address of your phone something like: 00:19:63:ED:30:0F

sdptool browse 00:19:63:ED:30:0F

Will show you what your phone can do

Now install dnsmasq and stop the service as you don't really want to run a full dns and dhcp service yet!

sudo update-rc.d -f dnsmasq remove

Create a file /etc/bluetooth/bnep0.up and add script to startup dnsmasq

!/bin/sh

Script to run stuff as the network comes up

echo 1 > /proc/sys/net/ipv4/ip_forward

ifup bnep0 sleep 2

test -f /var/run/dnsmasq-bnep0.pid && kill cat /var/run/dnsmasq-bnep0.pid

dnsmasq --pid-file=/var/run/dnsmasq-bnep0.pid \ --interface=bnep0 \ --localise-queries \ --dhcp-range=192.168.44.10,192.168.44.20,255.255.255.0

00:19:63:B4:52:01 - Bluetooth Mac address.

edit /etc/network/interfaces and add:

iface bnep0 inet static address 192.168.44.1 netmask 255.255.255.0 post-up iptables -t nat -A POSTROUTING -s 192.168.44.0/24 -j MASQUERADE post-up iptables -A FORWARD -i bnep0 -o eth1 -j ACCEPT post-up iptables -A FORWARD -o bnep0 -i eth1 -j ACCEPT

Note: It should probably add something about getting eth1 to be correct and also adding post-down to remove the firewall.

On the phone create a new bluetooth connection to the linux box and you are off.

blog comments powered by Disqus