File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_use_nokia_6230i_over_bluetooth_as_a_gprs_modem.mdwn
Revision 1.4: download - view: text, annotated - select for diffs
Wed Apr 17 17:36:08 2019 UTC (14 months, 2 weeks ago) by sevan
Branches: MAIN
CVS tags: HEAD
Use the bluetooth rc script to get started, btconfig doesn't exist

    1: **Contents**
    2: 
    3: [[!toc]]
    4: 
    5: #  Requirements 
    6: 
    7: You will need a mobile phone with GPRS and Bluetooth, a Bluetooth device and a NetBSD system that supports Bluetooth (4.0 and above). 
    8: 
    9: In this example, we are using a Nokia 6230i phone, a Broadcom USB dongle and NetBSD 4.9.11. 
   10: 
   11: #  Setting up pppd 
   12: 
   13: We need to create some pppd options and chat scripts, first create the directories 
   14:     
   15:       # mkdir -p /etc/ppp/peers
   16:     
   17: 
   18: Create a /etc/ppp/options file containing 
   19:     
   20:       #
   21:       # default options file for [pppd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?pppd+8+NetBSD-current)
   22:       #
   23:       57600
   24:       crtscts
   25:       local
   26:       defaultroute
   27:       usepeerdns
   28:       noipdefault
   29:       nodetach
   30:     
   31: 
   32: 
   33: and a /etc/ppp/chat.gsm file containing 
   34:     
   35:       #
   36:       #  Chat script to dial out with GSM phone
   37:       #
   38:       ABORT     "BUSY"
   39:       ABORT     "NO CARRIER"
   40:       ABORT     "DELAYED"
   41:       ABORT     "NO DIALTONE"
   42:       ABORT     "VOICE"
   43:       
   44:       TIMEOUT   10
   45:       ""        AT
   46:       OK-AT-OK  AT&F
   47:       OK        AT+CGDCONT=1,"IP","\U"
   48:       
   49:       TIMEOUT   60
   50:       OK        ATDT\T
   51:       CONNECT   \c
   52:     
   53: 
   54: Create a /etc/ppp/peers/gprs file containing 
   55:     
   56:       #
   57:       # pppd(8) options file for GPRS
   58:       #
   59:       # The Access Point Name (APN) used by your GSM Operator may need
   60:       # to be different from the "internet" used below.
   61:       #
   62:       pty "rfcomm_sppd -a phone -d ubt0 -s DUN -m encrypt"
   63:       connect "/usr/sbin/chat -V -f /etc/ppp/chat.gsm -U internet -T *99#"
   64:       noccp
   65:     
   66: 
   67: ##  Configuring Bluetooth 
   68: 
   69: First, activate Bluetooth on your phone, on the Nokia 6230i as follows 
   70:     
   71:       Menu > Settings > Connectivity > Bluetooth > Bluetooth settings > My phone's name
   72:       Choose a name for your device, for this example I will use "My Nokia"
   73:       
   74:       Menu > Settings > Connectivity > Bluetooth > Bluetooth settings > My phone's visbility
   75:       Choose "Shown to all"
   76:       
   77:       Menu > Settings > Connectivity > Bluetooth > Bluetooth >
   78:       Choose "Bluetooth on"
   79:     
   80: 
   81: Plug your Bluetooth dongle into your computer and you should see something like the following on the console 
   82:     
   83:       ubt0 at uhub0 port 1 configuration 1 interface 0
   84:       ubt0: Broadcom BCM92035DGROM, rev 1.10/0.04, addr 2
   85:     
   86: 
   87: Now, we need to establish a Bluetooth connection between your phone and computer. Enable the Bluetooth dongle 
   88:     
   89:       # /etc/rc.d/bluetooth start
   90:       Configuring Bluetooth controllers: ubt0.
   91:       starting Bluetooth Link Key/PIN Code manager
   92:       starting Bluetooth Service Discovery server
   93:     
   94: 
   95: and perform an inquiry to discover the Bluetooth device address of your phone 
   96:     
   97:       # btconfig ubt0 inquiry
   98:       Device Discovery from device ubt0 ..... 1 response
   99:        1: bdaddr 00:22:b3:22:3e:32
  100:         : name "My Nokia"
  101:         ...
  102:     
  103: 
  104: Add an alias of the bdaddr (yours will be different) to /etc/bluetooth/hosts 
  105:     
  106:       # echo "00:22:b3:22:3e:32 phone" >> /etc/bluetooth/hosts
  107:     
  108: 
  109: Next set up a PIN in order to pair the phone with your Bluetooth dongle 
  110:     
  111:       # btpin -a phone -r -l 6
  112:       PIN: 928434
  113:     
  114: 
  115: and attempt to open a manual RFCOMM connection to the Dial Up Networking (DUN) service on the phone (press ^C to close the connection) 
  116:     
  117:       # rfcomm_sppd -a phone -s DUN
  118:       Starting on stdio...
  119:       AT
  120:       OK
  121:       ATI
  122:       Nokia
  123:       ATI3
  124:       Nokia 6230i
  125:       
  126:       OK
  127:       ^C
  128:     
  129: 
  130: Your phone should prompt you for accepting the connection from your computer, accept it and enter the PIN that btpin generated to complete the pairing process. 
  131: 
  132: Now we can start pppd 
  133:     
  134:       # pppd call gprs
  135:       Serial connection established.
  136:       Connect:  ppp0 <--> /dev/ttyp9
  137:       local     IP address 10.177.120.221
  138:       Remote    IP address 10.4.4.4
  139:       Primary   DNS address IP
  140:       Secondary DNS address IP
  141:     
  142: 
  143: You are now online. To terminate your pppd session just press Control + C, or send a SIGHUP to the pppd process. 
  144: 
  145: #  Advanced Configuration 
  146: 
  147: You may find that some phones require authentication when connecting to PPP, this will be a username/password provided by your GSM Operator. 
  148: 
  149: Create a /etc/ppp/chap-secrets file, owned by root and unreadable by anybody else (mode 0600) containing 
  150:     
  151:       #
  152:       # CHAP/PAP secrets file
  153:       #
  154:       "user" * "pass"
  155:     
  156: 
  157: and add the following line to the /etc/ppp/peers/gprs file 
  158:     
  159:        user "user"
  160:     
  161: 
  162: To automatically configure the DNS server when the PPP link is brought up, create a /etc/ppp/ip-up file containing 
  163:     
  164:       #!/bin/sh
  165:       #
  166:       # ip-up <interface> <tty> <speed> <local-ip> <remote-ip> <ipparam>
  167:       #            $1      $2      $3       $4         $5          $6
  168:       #
  169:       
  170:       if [ -f /etc/ppp/resolv.conf ]; then
  171:           rm -f /etc/resolv.conf
  172:           mv /etc/ppp/resolv.conf /etc/resolv.conf
  173:       fi
  174:     
  175: 
  176: #  See Also 
  177: 
  178: The [Bluetooth section in the NetBSD Guide](http://www.netbsd.org/docs/guide/en/chap-bluetooth.html) contains more general Bluetooth configuration, and details of all PPP options can be found in the [pppd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?pppd+8+NetBSD-current) manpage. 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb