Mobile Internet via Bluetooth on Ubuntu-7.10

My old instructions on setting up internet access from Ubuntu-7.10 via a mobile phone from Telstra or Optus on Ubuntu Linux. Connecting to wireless internet plans via bluetooth. Tested with Next G, (HSDPA) and GPRS.

Tested phone hardware:

  • iMate JasJam
  • Nokia 6110 Navigator
  • Nokia 6120 Classic (ref)

Drop me a note if you have successfully (or not) tested this guide with other phones

Step 1: Creating an rfcomm dun connection via bluetooth

Computer <-bluetooth-> Mobile Phone <-gprs-> Internet

I will not run through setting up bluetooth devices here. Using Ubuntu 7.10 no real configuration was necessary for my laptop to be able to see my phone.

First pair the phone with the computer. I initiated this from my phone, and a passkey popup appeared in my systray and after entering the same password on both devices pairing was successful. You then need to find the mac (hardware) address of you phone and the channel it advertises it’s dun service on. On my Nokia 6110 it’s always been channel 4, but on my iMate, sometimes it’s 3, sometimes it’s 4. I should write a python script to automate this soon, to supply you with a list of dun channels and devices and let you connect to one.

~# hcitool scan
Scanning ...
        00:17:E3:6D:58:73       PocketPC
        00:1B:AF:DB:29:3D       Nokia6110

Here for example, the mac address of my Nokia is 00:1B:AF:DB:29:3D.

Now lets find the dun ports availavable

~# sdptool search dun
Inquiring ...
Searching for dun on 00:17:E3:6D:58:73 ...
Service Name: Dial-up Networking
Service RecHandle: 0x10004
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 3
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

Searching for dun on 00:1B:AF:DB:29:3D ...
Service Name: Dial-Up Networking
Service RecHandle: 0x10018
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 4
Language Base Attr List:
  code_ISO639: 0x454e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

From that output you can see the dun channel for the iMate if 3 and the Nokia is 4

Now we need to bind to one of those channels. This takes the form of:

sudo rfcomm bind <rfcomm_port> <mac> <dun_channel>

And using the example of the the iMate, I would use:

~# sudo rfcomm bind 0 00:17:E3:6D:58:73 3

Other handy commands are:

~# rfcomm
rfcomm0: 00:1B:AF:DB:29:3D channel 4 closed
~# sudo rfcomm release 0
~# rfcomm

rfcommlists all connected channels and their status

rfcomm release <rfcomm_port>closes that channel again.

I have found it fairly safe to leave the rfcomm channel connected across sessions as well and phone reboots, but it will need to be reconnected on each reboot unless the connection is put into /etc/bluetooth/rfcomm.conf

I have not put mine into rfcomm.conf because the iMate changes channel on me and it depends on which phone I use. I know I could make an rfcomm.conf entry for each one, but I just havnt got round to it yet.

Step 2: Creating config files

I will run through the files that need to be created for bigpond. There is actually one line that has to be changed for Optus, and I will note that on the way. If you are a neat freak (or are setting up both interfaces like me) then also change the names of the files to optus, optus-connect, and optus-disconnect and change the connect and disconnect lines to match.

/etc/ppp/peers/bigpond

connect "/usr/sbin/chat -v -f /etc/ppp/peers/bigpond-connect"
disconnect "/usr/sbin/chat -v -f /etc/ppp/peers/bigpond-disconnect"
debug
/dev/rfcomm0
defaultroute
usepeerdns
user "guest"

/etc/ppp/peers/bigpond-connect

TIMEOUT         5
ECHO            ON
ABORT           'nBUSYr'
ABORT           'nERRORr'
ABORT           'nNO ANSWERr'
ABORT           'nNO CARRIERr'
ABORT           'nNO DIALTONEr'
ABORT           'nRINGINGrnrnRINGINGr'
''              rAT
TIMEOUT         12
SAY             "Press CTRL-C to close the connection at any stage!"
SAY             "ndefining PDP context...n"
OK              ATH
OK              ATE1
OK              'AT+CGDCONT=1,"IP","telstra.internet"'
OK              ATM1L3DT*99#
TIMEOUT         10
SAY             "nwaiting for connect...n"
CONNECT         ""
SAY             "nConnected."
SAY             "nIf the following ppp negotiations fail,n"
SAY             "try restarting the phone.n"

(Change “telstra.internet” to “internet” if you are using Optus)

/etc/ppp/peers/bigpond-disconnect

ABORT           "BUSY"
ABORT           "ERROR"
ABORT           "NO DIALTONE"
SAY             "nSending break to the modemn"
""              "K"
""              "K"
""              "K"
""              "+++ATH"
""              "+++ATH"
""              "+++ATH"
SAY             "nPDP context detachedn"

Step 3: File changes needed

Append to /etc/ppp/chap-secrets

"guest" * "guest" *

Append to /etc/ppp/pap-secrects

"guest" * "guest" *

Append to /etc/network/interfaces

iface bigpond inet ppp
    provider bigpond

(bigpond references will become optus if you changed the names of the files earlier to match)

Step 4: Testing

The easiest way to monitor the connection is tail -f /var/log/messagesin a second terminal while activating the connection in the first terminal.

To start the connection:

~# pon bigpond

To stop the connection

~# poff bigpond

A transcript of my log file of a successfull connection and disconnection via telstra.

Nov  2 23:11:46 narwhal pppd[8200]: pppd 2.4.4 started by kbowden, uid 1000
Nov  2 23:11:49 narwhal chat[8206]: timeout set to 5 seconds
Nov  2 23:11:49 narwhal chat[8206]: abort on (nBUSYr)
Nov  2 23:11:49 narwhal chat[8206]: abort on (nERRORr)
Nov  2 23:11:49 narwhal chat[8206]: abort on (nNO ANSWERr)
Nov  2 23:11:49 narwhal chat[8206]: abort on (nNO CARRIERr)
Nov  2 23:11:49 narwhal chat[8206]: abort on (nNO DIALTONEr)
Nov  2 23:11:49 narwhal chat[8206]: abort on (nRINGINGrnrnRINGINGr)
Nov  2 23:11:49 narwhal chat[8206]: send (^MAT^M)
Nov  2 23:11:49 narwhal chat[8206]: timeout set to 12 seconds
Nov  2 23:11:49 narwhal chat[8206]: expect (OK)
Nov  2 23:11:49 narwhal chat[8206]: ^MAT^M^M
Nov  2 23:11:49 narwhal chat[8206]: OK
Nov  2 23:11:49 narwhal chat[8206]:  -- got it
Nov  2 23:11:49 narwhal chat[8206]: send (ATH^M)
Nov  2 23:11:49 narwhal chat[8206]: expect (OK)
Nov  2 23:11:49 narwhal chat[8206]: ^M
Nov  2 23:11:49 narwhal chat[8206]: ATH^M^M
Nov  2 23:11:49 narwhal chat[8206]: OK
Nov  2 23:11:49 narwhal chat[8206]:  -- got it
Nov  2 23:11:49 narwhal chat[8206]: send (ATE1^M)
Nov  2 23:11:49 narwhal chat[8206]: expect (OK)
Nov  2 23:11:49 narwhal chat[8206]: ^M
Nov  2 23:11:49 narwhal chat[8206]: ATE1^M^M
Nov  2 23:11:49 narwhal chat[8206]: OK
Nov  2 23:11:49 narwhal chat[8206]:  -- got it
Nov  2 23:11:49 narwhal chat[8206]: send (AT+CGDCONT=1,"IP","internet"^M)
Nov  2 23:11:49 narwhal chat[8206]: expect (OK)
Nov  2 23:11:49 narwhal chat[8206]: ^M
Nov  2 23:11:49 narwhal chat[8206]: AT+CGDCONT=1,"IP","internet"^M^M
Nov  2 23:11:49 narwhal chat[8206]: OK
Nov  2 23:11:49 narwhal chat[8206]:  -- got it
Nov  2 23:11:49 narwhal chat[8206]: send (ATM1L3DT*99#^M)
Nov  2 23:11:49 narwhal chat[8206]: timeout set to 10 seconds
Nov  2 23:11:49 narwhal chat[8206]: expect (CONNECT)
Nov  2 23:11:49 narwhal chat[8206]: ^M
Nov  2 23:11:50 narwhal chat[8206]: ATM1L3DT*99#^M^M
Nov  2 23:11:50 narwhal chat[8206]: CONNECT
Nov  2 23:11:50 narwhal chat[8206]:  -- got it
Nov  2 23:11:50 narwhal chat[8206]: send (^M)
Nov  2 23:11:50 narwhal pppd[8200]: Serial connection established.
Nov  2 23:11:50 narwhal pppd[8200]: Using interface ppp0
Nov  2 23:11:50 narwhal pppd[8200]: Connect: ppp0 <--> /dev/rfcomm0
Nov  2 23:11:51 narwhal pppd[8200]: PAP authentication succeeded
Nov  2 23:11:52 narwhal pppd[8200]: local  IP address 58.109.227.207
Nov  2 23:11:52 narwhal pppd[8200]: remote IP address 10.6.6.6
Nov  2 23:11:52 narwhal pppd[8200]: primary   DNS address 61.88.88.88
Nov  2 23:11:52 narwhal pppd[8200]: secondary DNS address 61.88.88.88
Nov  2 23:12:13 narwhal pppd[8200]: Terminating on signal 2
Nov  2 23:12:13 narwhal pppd[8200]: Connect time 0.4 minutes.
Nov  2 23:12:13 narwhal pppd[8200]: Sent 2538 bytes, received 1582 bytes.
Nov  2 23:12:13 narwhal pppd[8200]: Connection terminated.
Nov  2 23:12:13 narwhal chat[8302]: abort on (BUSY)
Nov  2 23:12:13 narwhal chat[8302]: abort on (ERROR)
Nov  2 23:12:13 narwhal chat[8302]: abort on (NO DIALTONE)
Nov  2 23:12:13 narwhal chat[8302]: send (K^M)
Nov  2 23:12:13 narwhal last message repeated 2 times
Nov  2 23:12:13 narwhal chat[8302]: send (+++ATH^M)
Nov  2 23:12:13 narwhal last message repeated 2 times
Nov  2 23:12:13 narwhal pppd[8200]: Serial link disconnected.
Nov  2 23:12:14 narwhal pppd[8200]: Exit.

If that was successful you should now be able to start and stop the connection via NetworkManager.

nm-applet-bluetooth

Closing Notes

  • I know internet via phone is not supplied by bigpond, but it’s easier for me to remember
  • I found the iMate JASJAM to need a lot of resetting due to either the phone crashing, or no longer responding to dialup requests
  • It does not matter what the username and password are. I just could not get pppd to connect without one.
  • You do NOT need to start the Wireless Modem application on the iMate for this to work.
  • I have seen people put quite a lot of options into /etc/ppp/peers/bigpond type files. I have put the minimum in I need for it to work reliably for me. Your mileage may vary.
  • NetworkManager does not show any connection status for dial up sessions, I should check to see if there is a bug filed yet.

Credits

http://www.hingston.demon.co.uk/mike/nokia6680.html

This entry was posted in Desktop and tagged , , , , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

9 Comments

  1. Jasp
    March 18, 2009 7:12 pm

    Thank you, thank you, thank you!

    I was having the hardest time getting Bluetooth DUN to work for me on my Gentoo laptop with my Sony Ericsson W850i. But using your chat script here finally made it all work for me, woo! :-)

  2. June 14, 2009 5:25 am

    I followed your instructions and could get my Motorola MQ9h to connect via bluetooth to Vodacom Network in South Africa (dialup number *99***1#) and user ¨¨.
    tailing log as described proofs the connection. however I still need to figure out how to get my browser, etc to use the new connection to connect to the internet…

    Any ideas?

    • June 14, 2009 11:19 am

      Are you using NetworkManager for connecting? If so make sure there is only one default gateway. Then all applications will use it automatically. ie, if you are not connected to any other wired or wireless connections then the dialup connection will be used.

  3. June 15, 2009 2:14 am

    I am using Network Manager Applet 0.7.0. My normal connection I use is a wireless connection – I disabled wireless networking for my tests.
    I tried but cannot ping google and microsoft even by ipaddresses.

  4. June 15, 2009 2:16 am

    I used pon and poff to connect. How do I get the bluetooth dun connection to display on the network manager?

  5. June 15, 2009 4:16 am

    I removed and reinstalled all my network packages ( using synaptic). This caused me some problems in terms of reinstalling them, since I then lost all network connectivity :-(. But I could reconfigure the sources to only look at the cd and reinstall them.
    My network name resolution now works – thank you very much for responding to my problem. You can now take it this method works using Motorola MQ9h, on Ubuntu 8.10. (still connecting with pon and disconnecting with poff.) Hope to fugure out how to get this conenction in Network Manager listed….

    • June 15, 2009 10:16 am

      To have a PPP connection show up in network manager, it just needs to be listed in /etc/network/interfaces. ie:

      iface bigpond inet ppp
      provider bigpond

      As far as I know this still applies even through to ubuntu-9.04.

  6. June 15, 2009 4:58 pm

    The above does not seem to work on my installation Ubuntu 8.10, NetworkManager Applet 0.7.0

    • June 15, 2009 5:16 pm

      Well, your right! From nm-0.7.0 /usr/share/doc/network-manager/README.Debian:

      Dial-up configuration
      ~~~~~~~~~~~~~~~~~~~~~

      Your dialup configurations can now be one in network-manager connection editor. Because of that /etc/network/interfaces configurations are considered “legacy” from a network manager point of view.

      However, if you want to use your /etc/network/interfaces configuration make sure that you have the ifupdown plugin in “Unmanaged mode” and take care that the used wired/wireless device is also configured in /etc/network/interfaces.

      Not that NetworkManager 0.7 will not provive UI hooks to up and down ppp connections managed outside of NetworkManager itself (not that it ever worked nicely before).

      — Alexander Sack , Mon, 6 Oct 2008 13:05:00 +0200

      I don’t think the Mobile Broadband support in nm-0.7 will handle bluetooth dun connections, but then again I have never looked or tried.