====== Connecting Linux to the Internet via Bluetooth and GPRS ====== {{pub:linux_bt_gprs.jpg?300 }} After I bought my [[http://europe.nokia.com/A4144368|Nokia 6681]] phone, I spent some time trying to figure out how to connect my notebook to the Internet through a [[wp>Bluetooth|bluetooth]] connection using [[wp>General_Packet_Radio_Service|GPRS]]. All I needed were some initialization strings to the bluetooth modem of my phone and the ppp network configuration of my phone company, [[wp>Claro_(mobile_phone_network)|Claro]]. I had no luck on Nokia's manuals and Claro did not even knew what I was talking about (although there is no way I can guess what are their configuration...). After "googling" //a lot//, I managed to find a working configuration. There are many configurations out there, all hard to find and many do not work... Here is the configuration that works for me. If you have another, feel free to edit this page and add it. This configuration worked on my Debian Lenny system, please adjust to your distribution. ===== Bluetooth ===== ==== Find the phone ==== The first thing is to configure a virtual serial port, that will be connected via bluetooth to the phone and work as a GSM modem. After you have your blueooth device working, try: root@morpheus:~# hcitool scan Scanning ... 00:E0:03:1D:CD:FD link root@morpheus:~# To find your phone's MAC. Here is my Nokia, its name is //link//. ==== Configure the serial port ==== Insert something similar to the following to ''/etc/bluetooth/rfcomm.conf'': rfcomm0 { # Automatically bind the device at startup bind yes; # Bluetooth address of the device device 00:E0:03:1D:CD:FD; # RFCOMM channel for the connection channel 1; # Description of the connection comment "link"; } Adjust the ''device'' and ''comment'' to match your phone. This will make ''/dev/rfcomm0'' virtual serial device to automatically connect to the phone when it is opened for reading. So, the modem will just "be there" when you need. ===== Set up PPP ===== [[wp>Point-to-Point_Protocol|PPP]] set up is quite simple when you already know the parameters... Add something like the following to ''etc/ppp/peers/claro'' (change the name of the file ''claro'' to one name suitable for you): /dev/rfcomm0 connect "/usr/sbin/chat -v -f /etc/chatscripts/claro" defaultroute replacedefaultroute lock debug noauth noccp persist user claro password claro usepeerdns noipdefault It basically will configure automatically all network parameters when connected and point to a chat script (explained below). * Note the ''/dev/rfcomm0'' setting, pointing to the bluetooth modem. * The ''debug'' setting is useful to detect problems (''pppd'' will print debugging to syslog, on Debian at ''/var/log/syslog''). * My ISP seems to work with deflate compression (enabled by default), if you have problems add the option ''nodeflate''. I also added ''noccp'', since my ISP rejects it. * The ''persist'' setting will make it try to reconnect if the connection is broken. * Adjust the ''user'' and ''password'' to the ones provided by the phone company (they have to give you this information). Try looking for it on you phone's connection settings. The chat script was the hard part... It was hard to find a working one. Here is the one that works with my Nokia 6681 and my phone company Claro, ''/etc/chatscripts/claro'' (also rename it to match one name good for you and matches the pppd configuration above): '' ATZ OK-AT-OK AT+CGDCONT=1,"IP","claro.com.br" OK "ATD*99***1#" CONNECT '' The number ''*99***1#'' seems to be standard to GSM (I am not sure, if in doubt, ask your company). It is also needed to adjust the string ''claro.com.br'' to the one provided by your phone company. This one can be easily found on your phone connection settings. ==== Connect ==== That's it. You should have a working connection now. Try it with: fabio@morpheus:~$ pon claro Where ''claro'' is the name of the file at ''/etc/ppp/peers/''. Check out the log information at syslog to see if everything worked fine. To disconnect, just: fabio@morpheus:~$ poff claro I believe there is a way to make it work using kppp or other graphical tool, I have not tryed. ===== Speed ===== I got around 165kbps and a latency of at least 400ms to 4s... In practice, GPRS seems to fail 10% of the times I try to use it. I am not sure if it is Claro's fault or all GPRS are like this. ===== References ===== * [[http://www.bluez.org/|BlueZ - Official Linux Bluetooth protocol stack]] * [[ftp://ftp.samba.org/pub/ppp/|PPP for Linux]]