Wednesday, October 25, 2006

My Phone - GPRS - Bluetooth - Notebook - Internet

I have a Sony Ericsson Z600 mobile phone. I bought it 3 years ago. I had the GPRS enabled in my Mobitel Connection and used my Phone as a GPRS modem, to browse the Internet via my old notebook (provided from the office) using IR port. I did it in Windows, no worries. But after I installed Linux I couldn't configure my IR port and unable to connect to Internet via GPRS. But with my new notebook, Compaq Presario V3000 (Intel Core Duo) I had bluetooth inbuilt. After installing Ubuntu Dapper I gave it a try to connect via bluetooth. Bingo. Succeeded. After lot of Googling, I should say. So for the sake of people who need to connect to the Internet using their notebooks and Bluetooth phones, I thought of blogging my experience on that. You may find many good how to s related to this scenario though.

This is more adoptable for Ubuntu Dapper, but general configurations are same for other Distros too.



Prerequisites

  • Latest 2.6 Kernel.
  • bluez-utils.
  • ppp.
  • openbox.
  • Bluetooth & GPRS enabled phone that can be used as a modem.
  • Bluetooth enabled PC/notebook. (those who don't have an inbuilt bluetooth port can use a bluetooth doungle instead.)
Install software.

$ apt-get update (just to update the packages in the source list)
$ apt-get install bluez-utils
$ apt-get install openbox
$ apt-get install ppp
Take a Terminal and become root (or sudo). I prefer to keep the root privileges rather than sudo. Turn on both phone's and PC's bluetooth service.

Discover the bluetooth phone from your notebook

$ sudo su -
$ hcitool scan

This is my phone's MAC address. You may copy the MAC address because you gonna need it few more times in this process.

00:0F:D9:BC:EA:C0 Dassa.Z600

Now pair your phone with notebook

$ hcitool cc 00:0F:D9:BC:EA:C0
$ hcitool auth 00:0F:D9:BC:EA:C0

You should put your phone's MAC address here.

Now you have to configure your device{modem (rfcomm)}

Get your channel number for your phone's dial up service

$ sdptool browse 00:0F:D9:BC:EA:C0
Check for “Service Name : Dial-up Networking”. And check and remember the Channel number. Mine it was “Channel : 1”

Now edit the /etc/bluetooth/rfcomm.conf
$ vim /etc/bluetooth/rfcomm.conf

Mine it was like this, you should replace your MAC and Channel No.

# RFCOMM configuration file.
# example:
# rfcomm0 {
# bind yes;
# # Bluetooth address of the device
# device 11:22:33:44:55:66;
# # RFCOMM channel for the connection
# channel 1;
# # Description of the connection
# comment "Example Bluetooth device";
#anuradha edited this.

rfcomm0 {
bind yes;
# Bluetooth address of the device
device 00:0F:D9:BC:EA:C0;
# RFCOMM channel for the connection
channel 1;
# Description of the connection
comment "Bluetooth Dialup";

Save and close frcomm.conf file.

Please note; I always keep the original file and work on a copy of that. Since I'm also a new linux guy, probability of going things wrong is very high.

Now create a peer file. This will create the peer to peer connection with the Notebook and phone.

$ vim /etc/ppp/peers/BluetoothDialup

connect "/usr/sbin/chat -v -f /etc/chatscripts/BluetoothDialup"
/dev/rfcomm0 115200
defaultroute
crtscts
lcp-echo-failure 0
#=======
/dev/rfcomm0 115200
connect '/usr/sbin/chat -v -f /etc/ppp/chat-gprs'
crtscts
modem -detach
noccp
defaultroute
usepeerdns
noauth
ipcp-accept-remote
ipcp-accept-local
noipdefault

This is how my peer file looks like.

Now you need to create a chat script for the connection.

My /etc/chatscripts/BluetoothDialup file look like this.

TIMEOUT 40
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
OK 'AT+CGDCONT=2,"IP","wap"'
OK ATD*99***1 #
CONNECT ""

Note: You have to replace the “wap” with your APN, and ADT number with your service provider's dialing number.

There is another thing to specify here, if you are using a PIN (pass key) to pair bluetooth devices you need to create a file containing the pin. I use a pin and I created that file as below.

$ vim /etc/bluetooth/pin

1111

This is a sample, you have to put your pin number here.
save and close.

Check whether you have a user that have the privileges to use the modem, else create a user that have the privilege.

$ adduser username dialout

Now get connected. Brows the Internet.

$ cd /etc/chatscripts
$ pon BluetoothDialup

Note: Some times you might get an error related to proxy server, if that problem showed up, go to edit – Preferences, under General tab go to Connection Settings... Select Auto Detect Proxy Settings for this Connection. Then give it a try.

After surfing, you have to close the connection.

$ poff BlutoothDialup

It's always good to close the peer connections too.
$ /etc/init.d/bluez-utils stop

Good Luck!

For me this setup was suitable. But what I have experienced is, sometimes one person's settings will not 100% suite for another one. I used several howtos to get my work done. This is the set of settings which worked for me. Can't say this will work for you too.

2 comments:

Voice in Colombo said...

How is the speed of GPRS internet access? Is it "manageable" or sucking slow? I also looking into having a try. Right now, I have a bluetooth enabled notebook (Windows) and a GPRS enabled SIM from Dialog. My phone doesn't support Bluetooth. So, if I shift to a Bluetooth phone, that's it? right?

~ lo$t $oul ~ said...

could you give details about connecting via bluetooth/IR, i got both of them on my laptop and phone. so connectivity is no problem, i need to know the configuration steps.