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.

Monday, October 23, 2006

Hello... How are you?

After a little bit busy but enjoyable two weeks in AIT, Thailand I returned home on 2nd October. Well... I should say something about AIT. Asian Institute of Technology, is one of leading Institution / campus which mostly provide Master and Ph.Ds. If any one of you wish to follow a master's degree in Engineering or any other field, and if you wish to follow it in a South Asian country, I like to suggest Asian Institute of Technology without a doubt. Even though I'm a GNU/Linux Lover I went through the course without a problem. I played around a lot with Windows Server 2003 two years ago. Actually Win Server 2003 was in beta those days. I have created Intranet/s, Domain Controllers, Web Servers, etc, with Windows. But after I got my self into GNU/Linux I changed my Web Sever OS from Win Serv 2003 to Linux. I'm not going to stick in to one OS or Platform, but I will use Linux and Open Source Solutions at my work as much as possible. Because Linux created a new chapter in my life, and I like the freedom which comes with it.

Humm,.. after my last post again I was silent for a while. Actually I was off line for the last two weeks. I got married. Shocked? don't be. it's a normal step in our life cycle. I also have completed that step. I have realized about human life cycle, a long time ago. Birth, spending the life and death. We say “SPENDING” the life, why we say spending? Think for your self. You spend it, you never get it back. The time you passed is past, we can't drag it back. So we should live this moment joyfully, and harmless to others, and helpful to others and to the society. And not to forget to love your love ones. Life has no UNDO s like computer applications, But life have REDO s. You can repeat the good things you did through out your life.

See you all in a while...