Using Bluetooth PAN profile to share GPRS/UMTS connection »

Sunday, 15 April 2007 | Linux; Windows Mobile | Dawid Lorenz

After upgrading my MDA Vario II mobile phone to the latest Windows Mobile 6 OS, I have somehow lost ability to create rfcomm device over Bluetooth. I’ve been to lazy to resolve that problem, but I wasn’t lazy enough to find out how to use new WM6’s feature, which is internet connection sharing via Bluetooth PAN profile. It turned out to be quite easy and straightforward task. Read on.

The most comprehensive source of knowledge about Bluetooth PAN under Linux is hidden in one single HOWTO file. However, in this case, I will use only a little part of that knowledge.

First of all, we need to create ifcfg-bnep0 file in /etc/sysconfig/network-scripts directory:

DEVICE=bnep0
BOOTPROTO=dhcp
ONBOOT=no
TYPE=Ethernet
USERCTL=yes
IPV6INIT=no
PEERDNS=yes

This file creates new network device, which is somehow ‘virtual’, as it does not exist until connection with BT PAN profile would be established later on. Next, we need to set up internet connection sharing on WM6 device, by tapping Start -> Programs -> Internet Sharing. Choose Bluetooth PAN as PC Connection, and your preferred Network Connection (which usually is set up to connect with your mobile operator). Then tap Connect. Mobile phone should now establish GPRS/UMTS connection, and await for connections from computer.

Ok, mobile is ready to accept PAN connection, so.. let’s create connection. :) Execute following command:

pand --role PANU --search --service NAP

It will start PAN daemon, which will act as PAN User (–role PANU), and search for Bluetooth devices serving as Network Access Points (–search –service NAP). Searching for BT devices usually takes few seconds, but once pand finds appropriate device, connection is established quickly. On the other hand, if we know physical address of mobile’s BT adapter, following command will establish connection straight away:

pand --role PANU --connect xx:xx:xx:xx:xx:xx

Where xx:xx:xx:xx:xx:xx is device’s address. If something goes wrong, check out system log (/var/log/messages), as all pand output goes right there.

After successful connection, mentioned before bnep0 network device should be automatically brought up with IP address assigned by DHCP. Once IP address is assigned, internet is in place! How cool is that? :)

Making life easier

I haven’t found any GUI interfaces for managing PAN connections, so again command line is always your best friend. However, there is possibility to make PAN connections slightly easier. As pand is regular system daemon, which could be controlled by System -> Administration -> Server settings -> Services GUI, we can start/stop it from there. Additional daemon parameters are saved in /etc/sysconfig/pand file:

#add any pand aguments you like, for example:
PANDARGS='--role PANU --search --service NAP'

Starting service from GUI (or - maybe even faster - from root terminal: service pand start), will pick up arguments stored in PANDARGS variable automatically. Just like that.

Related

Bluetooth PAN HOWTO - I think the best HOWTO regarding BT PAN. If you want to fiddle around, try different configurations or daemon parameters - you just MUST read it.

Appendix

Microsoft developers revealed reasons why WM6-powered devices are no longer acting as Dial-Up Networking modems over Bluetooth. Read on:
http://msmobiles.com/news.php/6260.html
and
http://blogs.msdn.com/windowsmobile/archive/2007/04/17/why-did-we-remove-bluetooth-dun.aspx

Comments:

  1. scaine
    Wednesday, 20 February 2008 @ 23:38

    Just a quick note - I’m using Ubuntu 7.10 on my Eee PC here and I’ve just bought a nano USB from Amazon. Thanks for the heads-up on using PAN - I’d been trying for the past two nights to get my MDA Vario II working with rfcomm and DUN.

    Anyway, the reason for the post - try out BlueMan when you get a chance. It’s an excellent, very slick looking GUI tool for just about any type of bluetooth service you could imagine. I’d been using it for DUN over serial (via Bluetooth), but when I read your guide on PAN, sure enough, you just go into Blueman’s services page and enable Network instead - click the add button, choose your device, then select from the real time populated list of services advertised via that device.

    I was connected to the internet through my T-Mobile 3G service in seconds and never saw the command line once.

    Makes a pleasant change that Ubuntu’s GUI tools outstrip the best that windows has to offer.

  2. Dawid Lorenz
    Thursday, 21 February 2008 @ 00:00

    Thanks for that tip - I’ll check BlueMan out soon.

    UPDATE: I’ve just installed BlueMan from the source, and… it’s really great! Thanks for that suggestion :)

  3. Jason
    Monday, 3 March 2008 @ 19:21

    Thanks for the info, will have to try it when I get home. Once connected via bluetooth does a WM6 Wizard allow you to sync Outlook contacts and calendar items with Evolution or Korganizer?

  4. Dawid Lorenz
    Monday, 3 March 2008 @ 19:38

    I never tried sync with Evolution, or anything. I mean I tried, but never succeeded.

  5. Tristan
    Monday, 7 July 2008 @ 06:34

    Genius,

    Thanks so much for this, been using my “Internet Sharing” on Windows as I couldn’t get it going on Linux!!

    Did this with an XDA Trion (HTC Hermes) running Windows Mobile 6 and a Centrino laptop running Ubuntu Heron.

    Thanks again!

    Tristan.

Anything to say?