From bit to a heart beat

insane innovations from a sane insanity

Sat Jul 18

Using your mobile as a Bluetooth modem for Ubuntu (10 simple steps!)

I have free GPRS on my mobile and sometimes I just need my daily dose of Internet even when I am at places with no Internet connection (island / mountain). I know there are many good solutions but sadly many of them are missing some important stuff. So, here is my take:

1. Download bluez-passkey-gnome

$ sudo apt-get install bluez-passkey-gnome

2. Run bluetooth-applet (you’ll see why in the next step)

$ sudo bluetooth-applet &

3. Pair you mobile with your Ubuntu

There is no need to enable your Bluetooth on your phone (will be automatically enabled later) but is vital to make your phone visible (at least for the time being). Also, enable your bluetooth on your Ubuntu. If you don’t know how, google around. There are many guides (it’s reeealy easy and probably is already enabled along with your wireless connection).

Find the “Paired Devices” screen on your phone’s menu and select “New paired device” and select your Ubuntu. Then you’ll be asked for a password (put whatever you like). At the same time, a dialog will popup from your Ubuntu, asking for the same password. After that, congrats, your phone and your Ubuntu are paired :D

There is no need to create a pin file inside the bluetooth directory (in case you where reading other tutorials). Bluetooth-applet handles everything.

4. Search for your phone from Ubuntu

$ hcitool scan
Scanning …
xx:xx:xx:xx:xx:xx My phone

The xx:xx:xx:xx:xx:xx your phone’s “id”. Will use it at the next steps.

4. Find the correct channel for Dial-Up networking (usually is channel 2)

$ sdptool browser xx:xx:xx:xx:xx:xx

Search for the Dial-Up networking and then check the number of channel.

5. Modify the file: /etc/bluetooth/rfcomm.conf

rfcomm0 {
# # Automatically bind the device at startup
bind yes;
#
# # Bluetooth address of the device
device xx:xx:xx:xx:xx:xx;
#
# # RFCOMM channel for the connection
channel 2;
#
# # Description of the connection
comment “My phone”;
}

Add your mobile’s “id” and the channel and you are set.

6. Restart bluetooth services

$ sudo /etc/init.d/bluetooth restart

7. Connect to the phone

$ rfcomm connect 0

There is another way to connect to your phone (using the id) but as long as you’ve done step 5, you are set :D

If it works, you should see

Press CTRL-C for hangup

8. Connection settings

You need to put these files (search for your provider). The examples below are for Vodafone Greece (I couldn’t find it anywhere online). If you can’t find yours online, you can either call them OR check the setting from your mobile (Internet Settings, connections, something like that). You should see something like this:

Name of access point: wapkarta.vodafone.gr

Write that down. We are gonna need it.

Update: These setting usually a proxy for your browser. Google around for the proxy or a better access point.

Now,  create a file :

$ sudo nano /etc/ppp/peers/vodafone

and paste this (they might be different for your provider! Google around!)

# from www.hingston.demon.co.uk/mike/nokia6680.html 
noauth
#change this if you move the path to your connect script
connect "/usr/sbin/chat -v -f /etc/chatscripts/vodafone-connect"
#change this if you move the path to your disconnect script
disconnect "/usr/sbin/chat -v -f /etc/chatscripts/vodafone-disconnect"
#I found that I needed this to remove problems with loopback on connecting
silent
#remove this if you don't want lots of information going to /var/log/messages
debug
#this is the device specified in your rfcomm.conf file
/dev/rfcomm0
#speed at which to connect - might be worth trying higher...
115200
#this is needed so that a default route is added to your routing table
defaultroute
#this is needed so that you pick up Orange's DNS settings
usepeerdns

Next,

$ sudo nano /etc/chatscripts/vodafone-connect

and paste this BUT put your access point (again, this is for Vodafone Greece)

#from www.hingston.demon.co.uk/mike/nokia6680.html
TIMEOUT 5
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
TIMEOUT 12

OK ATE1
#here's the magic bit!
#OK 'AT+cgdcont=1,"IP","wapkarta.vodafone.gr"'
# We found a better one that doesn't need a proxy and allows even ssh!
OK 'AT+cgdcont=1,"IP","webkarta.vodafone.gr"'
OK ATD*99***1#

and finally,

$ sudo nano /etc/chatscripts/vodafone-disconnect

# from www.hingston.demon.co.uk/mike/nokia6680.html
ABORT "BUSY"
ABORT "ERROR"
ABORT "NO DIALTONE"
SAY "\nSending break to the modem\n"
"" "\K"
"" "\K"
"" "\K"
"" "+++ATH"
"" "+++ATH"
"" "+++ATH"
SAY "\nPDP context detached\n"

9. Let’s connect!

First, check if the connection to your mobile is still up (step 7). If you don’t see

Press CTRL-C for hangup

connect to your phone again.

Now, the big monent!

$ sudo pon vodafone

starts the connection and you are online!

$ sudo poff vodafone

bring the connection down :P

10. Troubleshooting

Check /var/log/messages for problem when “calling your phone”.

If everything goes well you should see:

Jul 17 22:46:33 trinity pppd[9401]: PAP authentication succeeded
Jul 17 22:46:35 trinity pppd[9401]: local  IP address 10.2.116.125
Jul 17 22:46:35 trinity pppd[9401]: remote IP address 10.4.4.4
Jul 17 22:46:35 trinity pppd[9401]: primary   DNS address 210.239.17.10
Jul 17 22:46:35 trinity pppd[9401]: secondary DNS address 210.239.17.11

PS: Forget SSH unless you are ready for some tunneling

Also check this (great tutorial which I borrowed MANY stuff) http://www.lynchconsulting.com.au/blog/index.cfm/2006/12/11/Nokia-N73-Bluetooth-modem-with-Ubuntu-Linux-Howto

Comments (View)
blog comments powered by Disqus