[ Back to Kevin's Homepage ]

Using a Cingular Treo 650 as a modem via Bluetooth

I have a Cingular Treo 650 that predates the AT&T company rename. I'm on an unlimited data PDA plan. While Bluetooth DUN on the Treo does work, it's not pretty since the phone will reboot quite a bit and chew through its battery, but frequently some connectivity is better than none!

These instructions were developed on a kubuntu 6.06 LTS machine, up-to-date as of 2007.09.14. Some of the file locations have definitely changed as you move forward from Dapper to Edgy and Feisty

First step is to make sure your Bluetooth dongle works.

My Bluetooth dongle happens to be a cheapie from Fry's Electronics, but it is supported. see Cheap Bluetooth Dongle for more detail

Second step is to pair your machine with your phone.

Third step is to setup the rfcomm serial port emulation and ppp

Extra credit: The below steps make your connection faster, but it is a whole lot more work. Scripting experience recommended.

  • DNS caching on the near side of a slow link makes everything faster. Installing nscd is a viable alternative to what I present here, and is probably easier, but I've had bad experiences with it. These scripts I've developed over the years, so they're still good for backporting with old rh8 systems! Yes, I still support some of those legacy installations.
  • Start by installing daemontools, the support software for djbdns' dnscache application
    cd /
    sudo bash
    mkdir /package
    cd /package
    # You may need this:  yes | apt-get install build-essential gcc make flex bison gdb
    # install daemontools
    wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
    gunzip /' <$F.orig >$F
        done
    
    cd admin/daemontools*
    sudo package/install
    # init starts the svscan process
    
  • Install djbdns so we can use dnscache
    cd /package
    wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
    gunzip /' <$F.orig >$F
        done
    
    # install djbdns
    cd /package/djbdns-1.05
    make
    make setup check
    
  • Turn on dnscache
    useradd dnscache
    useradd dnslog
    IP=127.0.0.1
    SUBNET=`echo $IP|cut -f1-3 -d.`
    dnscache-conf dnscache dnslog /etc/dnscache-$SUBNET $IP
    ln -s /etc/dnscache-$SUBNET /service
    echo "nameserver 127.0.0.1" >> /etc/resolv.conf
    
  • Configure dnscache so that it asks the DNS servers provided by Cingular.
    echo 66.102.163.231 > /service/dnscache-127.0.0/root/servers/@
    echo 66.209.10.201 >> /service/dnscache-127.0.0/root/servers/@
    echo 1 > /service/dnscache-127.0.0/env/FORWARDONLY
    
  • Restart and test dnscache
    svc -t /service/dnscache-127.0.0
    nslookup www.google.com 127.0.0.1
    nslookup www.google.com 127.0.0.1
    
    The first nslookup should take a few seconds, but the second one should be instant. If you can save 3 seconds for loading every web page, that's pretty signifigant.
  • Deconfigure your test dnscache
    svc -dx /service/dnscache-127.0.0
    sleep 1
    svc -dx /service/dnscache-127.0.0/log
    sleep 1
    rm -rf /service/dnscache-127.0.0 /etc/dnscache-127.0.0
    
  • So that was the easy part, getting dnscache installed and tested. However, your system isn't configured to use the local dnscache. that configuration file, /etc/resolv.conf is rewritten by pppd every time a connection is established. Therefore, we need to hook into the pppd startup scripts and rewrite the file ourselves.
  • Download if-local and network_config to /usr/local/etc. Yes, I know that newer version of ppp use /etc/ppp/ip-up.d/ but none of those scripts do quite what I want them to. Note also that if you want any of the functionality of those scripts, you'll have to add that in somewhere, because installing ip-up.local overrides and prevents any of the ip-up.d/ dir scripts from running.
    sudo bash
    mkdir /usr/local/etc
    chmod +x /usr/local/etc/if-local
    chmod +x /usr/local/etc/network_config
    
    /usr/local/etc/if-local install
    poff BluetoothDialup
    sleep 10
    pon  BluetoothDialup
    
    If the scripts are successful, you should see /etc/resolv.conf pointing to 127.0.0.3, and ps should show dnscache running. If not, check /tmp/LOG.ip-up.local, /tmp/LOG.network_config, and /tmp/LOG.ip-down.local for errors. Debugging is unfortunately going to take some reading of the code, as it doesn't handle errors very well. Adding the command "set -x" just after the "exec >>/tmp/LOG" and rerunning the poff/sleep/pon will log all the executed commands, so you can figure out what line is causing problems.
  • Extra credit #2: squid http proxy

    TBD

    Extra credit #3: Detect a down or hung connection and auto-restart

    TBD


    KJW - kjw@rightsock.com