[SWLUG] Bluetooth

Philip Barnes phil at trig222.f9.co.uk
Tue Nov 16 20:44:37 UTC 2004


On Tue, 2004-11-16 at 13:17 +0000, Steve Anderson wrote:
> Hello all.
> 
> Anyone got any experience of using Bluetooth with Linux? I've just 
> dragged myself into the 21st Century by getting a mobile with it, and 
> I'm wondering how easy it would be to share a network connection over 
> Bluetooth to it so I can have cheap/fast net access on it. (It's a Sony 
> Ericsson K700i, just on the off-chance someone knows it!)
> 
> I've managed to track down stuff about sharing files and contact info 
> under Linux, and sharing net connections under OSX and Windows, but I 
> want my always on Linux box to provide a gateway.
> 
> I've had a look at what USB dongles are supported under Linux, and it 
> seems to be pretty much all of them, so Maplin will get a visit later.
> 
> Any input, anyone?
> 
> BTW, been trying Ubuntu Linux. It's nice, if you like Gnome 2.8 and 
> Debian and can cope with their no-root-user paradigm (you sudo all the 
> time) or can be bothered creating root and chowning things. I did the 
> latter =)
> 
Hi Steve
I have had bluetooth networking working with a Palm T2 on both Fedora
Cores 1 & 2, using a class 1 dongle form Mapli. Its still a work in
progress on Core 3. I have also had gnokii working over bluetooth to my
6310i, I haven't got around to that yet as core 3 has only been out a
week!

With fedora bluetooth is supposed to work out of the box, take a look at
the Official Linux Bluetooth protocol stack at http://www.bluez.org/

And this is what I did...
I have installed the following RPMs from the Fedora Core 1 discs,       
        bluez-libs
        bluez-sdp
        bluez-utils
        bluez-pin
        bluez-pan
        bluez-hcidump
        bluez-bluefw

Edit the file /etc/bluetooth/pin, the pin will need to be entered into
the 
palm in oreder to pair with the PC.

        modprobe hci_usb        ; start the USB dongle
        hciconfig hci0 up       ; start bluetooth networking
        hcitool scan            ; check its all working by searching for
devices
                Scanning ...
                00:07:E0:nn:nn:nn       Slartibartfast   ; my palm
                00:60:57:nn:nn:nn       Zaphod           ; my phone

You need to create rfcomm devices as they are not created automatically
        mknod /dev/rfcomm0 c 216 0
        mknod /dev/rfcomm1 c 216 1

Edit the file /etc/bluetooth/hcid.conf to give a unique name to the
server.
        # Default settings for HCI devices
        device {
                # Local device name
                #   %d - device id
                #   %h - host name
                name "fordprefect";

                # Local device class
                class 0x120104;

        modprobe rfcomm ; start rf comms
        ;
        ; Listen for a connection on channel 1 and specify pc/palm ip   
        dund --listen --msdun --channel 1 192.168.0.1:192.168.0.2 
        ;
        ; enable port fowarding
        echo '1' > /proc/sys/net/ipv4/ip_forward
        ;
        ; Configure routing to link to eth0
        iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
        iptables -A FORWARD -i ppp0 -j ACCEPT
        iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j
ACCEPT

On the palm
        Add the PC to trusted devices.
        Create a new connection
                Add a name
                Connect to PC
                Via Bluetooth
                Tap to find device 
        Under details
                Speed   115 200 bps
                Flow Ctl        Automatic

        Create a network connection
                Add a service name
                Username        blank
                Password        leave as is
                Connection      Select connection created above
        Under details
                Connection type PPP
                Idle timeout    Never
                Query DNS       Unchecked
                Primary DNS     10.0.0.2   ; the DNS of my router,
                Secondary DNS   Blank      
                IP Address      Checked for automatic
        Script
                End                     ; Leave as is

Hit connect and it should all work, under view log you will find the IP 
addresses supplied into the dund line and you should be able to access
the net.

I have put the commands into /etc/rc.local so I just need to switch the
PC on.

The result is I can use my palm anywhere in the house. It may not work
too well if you have an old stone cottage with thick stone walls but in
a modern house it is great.

Hope this helps, any questions just ask.
Phil



More information about the Swlug mailing list