File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_use_nokia_6230i_over_bluetooth_as_a_gprs_modem.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Sun Nov 20 21:35:54 2011 UTC (2 years, 4 months ago) by mspo
Branches: MAIN
CVS tags: HEAD
even more pkgsrc.se imports

**Contents**

[[!toc]]

#  Requirements 

You will need a mobile phone with GPRS and Bluetooth, a Bluetooth device and a NetBSD system that supports Bluetooth (4.0 and above). 

In this example, we are using a Nokia 6230i phone, a Broadcom USB dongle and NetBSD 4.9.11. 

#  Setting up pppd 

We need to create some pppd options and chat scripts, first create the directories 
    
      # mkdir /etc/ppp /etc/ppp/peers
    

Create a /etc/ppp/options file containing 
    
      #
      # default options file for [pppd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?pppd+8+NetBSD-current)
      #
      57600
      crtscts
      local
      defaultroute
      usepeerdns
      noipdefault
      nodetach
    


and a /etc/ppp/chat.gsm file containing 
    
      #
      #  Chat script to dial out with GSM phone
      #
      ABORT     "BUSY"
      ABORT     "NO CARRIER"
      ABORT     "DELAYED"
      ABORT     "NO DIALTONE"
      ABORT     "VOICE"
      
      TIMEOUT   10
      ""        AT
      OK-AT-OK  AT&F
      OK        AT+CGDCONT=1,"IP","\U"
      
      TIMEOUT   60
      OK        ATDT\T
      CONNECT   \c
    

Create a /etc/ppp/peers/gprs file containing 
    
      #
      # pppd(8) options file for GPRS
      #
      # The Access Point Name (APN) used by your GSM Operator may need
      # to be different from the "internet" used below.
      #
      pty "rfcomm_sppd -a phone -d ubt0 -s DUN -m encrypt"
      connect "/usr/sbin/chat -V -f /etc/ppp/chat.gsm -U internet -T *99#"
      noccp
    

##  Configuring Bluetooth 

First, activate Bluetooth on your phone, on the Nokia 6230i as follows 
    
      Menu > Settings > Connectivity > Bluetooth > Bluetooth settings > My phone's name
      Choose a name for your device, for this example I will use "My Nokia"
      
      Menu > Settings > Connectivity > Bluetooth > Bluetooth settings > My phone's visbility
      Choose "Shown to all"
      
      Menu > Settings > Connectivity > Bluetooth > Bluetooth >
      Choose "Bluetooth on"
    

Plug your Bluetooth dongle into your computer and you should see something like the following on the console 
    
      ubt0 at uhub0 port 1 configuration 1 interface 0
      ubt0: Broadcom BCM92035DGROM, rev 1.10/0.04, addr 2
    

Now, we need to establish a Bluetooth connection between your phone and computer. Enable the Bluetooth dongle 
    
      # /etc/rc.d/btconfig start
      Configuring Bluetooth controllers: ubt0.
    

and perform an inquiry to discover the Bluetooth device address of your phone 
    
      # btconfig ubt0 inquiry
      Device Discovery from device ubt0 ..... 1 response
       1: bdaddr 00:22:b3:22:3e:32
        : name "My Nokia"
        ...
    

Add an alias of the bdaddr (yours will be different) to /etc/bluetooth/hosts 
    
      # echo "00:22:b3:22:3e:32 phone" >> /etc/bluetooth/hosts
    

Next set up a PIN in order to pair the phone with your Bluetooth dongle 
    
      # btpin -a phone -r -l 6
      PIN: 928434
    

and attempt to open a manual RFCOMM connection to the Dial Up Networking (DUN) service on the phone (press ^C to close the connection) 
    
      # rfcomm_sppd -a phone -s DUN
      Starting on stdio...
      AT
      OK
      ATI
      Nokia
      ATI3
      Nokia 6230i
      
      OK
      ^C
    

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. 

Now we can start pppd 
    
      # pppd call gprs
      Serial connection established.
      Connect:  ppp0 <--> /dev/ttyp9
      local     IP address 10.177.120.221
      Remote    IP address 10.4.4.4
      Primary   DNS address IP
      Secondary DNS address IP
    

You are now online. To terminate your pppd session just press Control + C, or send a SIGHUP to the pppd process. 

#  Advanced Configuration 

You may find that some phones require authentication when connecting to PPP, this will be a username/password provided by your GSM Operator. 

Create a /etc/ppp/chap-secrets file, owned by root and unreadable by anybody else (mode 0600) containing 
    
      #
      # CHAP/PAP secrets file
      #
      "user" * "pass"
    

and add the following line to the /etc/ppp/peers/gprs file 
    
       user "user"
    

To automatically configure the DNS server when the PPP link is brought up, create a /etc/ppp/ip-up file containing 
    
      #!/bin/sh
      #
      # ip-up <interface> <tty> <speed> <local-ip> <remote-ip> <ipparam>
      #            $1      $2      $3       $4         $5          $6
      #
      
      if [ -f /etc/ppp/resolv.conf ]; then
          rm -f /etc/resolv.conf
          mv /etc/ppp/resolv.conf /etc/resolv.conf
      fi
    

#  See Also 

The [[Bluetooth]] wiki page 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