How to use a T-Mobile cell phone as a bluetooth modem from Linux

Short instructions on how to use a Bluetooth enabled cell phone as a modem (allowing you to log into the Internet while mobile). A few of the commands are T-mobile specific (Look for, but most of the rest would apply to any service provider. With T-Mobile, you must have an activated data plan to use your phone as a modem. I am grandfathered into a plan called "T-Mobile Internet VPN" for 19.95 a month, but believe the current rate is closer to $40 a month.

  • First, make sure the phone and your linux box are paired.
  • Set up your rfcomm.conf file so that rfcomm0 will automatically bind to the phone when the pppd opens it. (You will have to use "hcitool scan" to find the appropriate bdaddr for your phone if you do not already know it. Be sure to set your phone to "discoverable" via the find me menu option first.) # # RFCOMM configuration file. # rfcomm0 { # Automatically bind the device at startup bind yes; # Bluetooth address of the device # Motorola V330 device 00:42:2C:5A:A0:26; channel 1; #Note that your phone will have a different Bluetooth device address, and #some phones use a channel other than 1 for their dial up networking service. #you can use hcitool scan to find the phones Bluetooth address, #and then sdptool search DUN to determine which RFCOMM #channel to use. # Description of the connection comment "Jay's Phone"; }
  • Configure your pppd to open rfcomm0 and have the appropriate settings using a peers file (I call mine gprs.) located by default in /etc/ppp/peers. My example: debug noauth connect '/usr/sbin/chat -v -f /etc/ppp/chat-tmobile-gprs' /dev/rfcomm0 115200 defaultroute usepeerdns #Other possibly useful settings depending upon your phone. #crtscts #kdebug 1 #ktune #lcp-echo-failure 0 #lcp-echo-interval 65535 #mtu 576
  • The chat-tmobile-gprs script sends the appropriate commands to the modem. TIMEOUT 15 ECHO ON ABORT '\nBUSY\r' ABORT '\nERROR\r' ABORT '\nNO ANSWER\r' ABORT '\nNO CARRIER\r' ABORT '\nNO DIALTONE\r' '' \rATZ # The following line was apparently unneeded for the V330 phone. However, it # WAS needed for the Nokia 9500 communicator phone (otherwise we got an # LCP terminated by host error message): OK AT+CGDCONT=1,"IP","",,0,0 OK ATD*99# CONNECT ""
  • Make sure that your bluetooth subsystem is running:service bluetooth status and if needed, service bluetooth start
  • Initate the call with the following command: pppd call gprs
  • It may be useful to have a second terminal open showing messages from the pppd, tail -f /var/log/messages for debugging purposes. If everything works, it should look something like this: kernel: CSLIP: code copyright 1989 Regents of the University of California kernel: PPP generic driver version 2.4.2 pppd[4664]: pppd 2.4.3 started by root, uid 0 hcid[2533]: link_key_request (sba=00:03:A4:3A:72:D1, dba=00:0A:A4:C7:3A:B7) chat[4665]: timeout set to 15 seconds chat[4665]: abort on (\nBUSY\r) chat[4665]: abort on (\nERROR\r) chat[4665]: abort on (\nNO ANSWER\r) chat[4665]: abort on (\nNO CARRIER\r) chat[4665]: abort on (\nNO DIALTONE\r) chat[4665]: send (^MATZ^M) chat[4665]: expect (OK) chat[4665]: ^MATZ^M^M chat[4665]: OK chat[4665]: -- got it chat[4665]: send (AT+CGDCONT=1,"IP","",,0,0^M) chat[4665]: expect (OK) chat[4665]: ^M chat[4665]: AT+CGDCONT=1,"IP","",,0,0^M^M chat[4665]: OK chat[4665]: -- got it chat[4665]: send (ATD*99#^M) chat[4665]: expect (CONNECT) chat[4665]: -- got it chat[4665]: send (^M) pppd[4664]: Serial connection established. pppd[4664]: Using interface ppp0 pppd[4664]: Connect: ppp0 < --> /dev/rfcomm0 kernel: PPP MPPE Compression module registered kernel: PPP BSD Compression module registered kernel: PPP Deflate Compression module registered pppd[4664]: local IP address pppd[4664]: remote IP address pppd[4664]: primary DNS address pppd[4664]: secondary DNS address

Leave a Reply

Your email address will not be published. Required fields are marked *