Connecting to GPRS over Bluetooth on Linux

From:http://www.jepstone.net/blog/2003/08/14/connecting-to-gprs-over-bluetooth-on-linux/

 

These are the notes I took to get this working today. I’ll update it if I learn anything new, because as with everything, there’s probably an easier way to do this. I’m using a Thinkpad A20m, Mandrake 9.1, a Socket Bluetooth card in a PCMCIA caddy, and a Nokia 3650 with service from T-Mobile. A big thanks to Schuyler Erle who steered me in the right direction on this!

 

Before you do anything, check out Tom’s attempts to get GPRS working over bluetooth with his laptop to get to a point where the scripts in this entry will be useful. In particular, be sure to set up /etc/bluetooth/bluepin as directed in that article. Next, edit your /etc/bluetooth/rfcomm.conf as shown here:

rfcomm0 {
  # Automatically bind the device at startup
  bind yes;

  # Bluetooth address of the device
  device YOURDEVICE;

  # RFCOMM channel for the connection
  channel 1;

  # Description of the connection
  comment "Nokia 3650 GPRS Modem";
}

Be sure to replace YOURDEVICE with your phone’s bluetooth ID (something like 00:11:22:33:44:55). Use the command sdptool search DUN to figure out that device’s number. Then, add this command to one of your startup scripts:

rfcomm bind rfcomm0

Now, set up an /etc/sysconfig/network-scripts/chat-ppp0 script with the following:

  TIMEOUT         5
  ECHO            ON
  ABORT           '/nBUSY/r'
  ABORT           '/nERROR/r'
  ABORT           '/nNO ANSWER/r'
  ABORT           '/nNO CARRIER/r'
  ABORT           '/nNO DIALTONE/r'
  ABORT           '/nRINGING/r/n/r/nRINGING/r'
  ''              /rAT
  TIMEOUT         12
  OK              ATE1
  OK              'AT+cgdcont=1,"IP","internet3.voicestream.com"'
  OK              ATD*99***1#

and set up a /etc/sysconfig/network-scripts/ifcfg-ppp0 script with (this is based on something I found here :

  DEVICE=ppp0
  CHATSCRIPT=/etc/ppp/chat-gprs
  ONBOOT=no
  MODEMPORT=/dev/rfcomm0
  LINESPEED=57600
  AUTH=no
  DEBUG=yes
  DEFROUTE=yes
  PERSIST=no
  HOLDOFF=10
  DEMAND=no
  PHONE='*99***1#'
  HARDFLOWCTL=no
  PEERDNS=yes
  MRU=1500
  MTU=1500
  RETRYCONNECT=yes

You can then fire up the connection with/etc/sysconfig/network-scripts/ifup ppp0 For reasons I haven’t been able to figure out, it takes three tries to get it working. The first time, you’ll see this in /var/log/messages:

  ...
  Aug 14 08:04:53 camfrancium chat[2989]: Failed ( NO CARRIER^M)
  Aug 14 08:04:53 camfrancium pppd[2971]: Connect script failed
  Aug 14 08:04:54 camfrancium pppd[2971]: Exit.

the second time, you may see this:

  ...
  Aug 14 08:05:12 camfrancium pppd[3017]: Serial line is looped back.
  Aug 14 08:05:12 camfrancium pppd[3017]: Connection terminated.
  Aug 14 08:05:13 camfrancium pppd[3017]: Exit.

and finally, you’ll see this (success):

  ...
  Aug 14 08:05:22 camfrancium pppd[3077]: primary   DNS address 216.155.175.170
  Aug 14 08:05:22 camfrancium pppd[3077]: secondary DNS address 216.155.175.171

So, in theory, all you need to do to make the connection is:

  # rfcomm bind rfcomm0     #(only once until you reboot again)
  # /etc/sysconfig/network-scripts/ifup ppp0

你可能感兴趣的:(Connecting to GPRS over Bluetooth on Linux)