Thursday, April 15, 2010

GPRS Internet on Ubuntu 9.10 using Nokia mobile phone

I have been trying to set up my laptop with a GPRS connection using my mobile phone - in this case a Nokia 5230 cell. I have found out that in Greece, telecom company named WIND offers in its F2G card a 3GB (!!) free internet connection and I wanted to experiment with it. In Windows (duh) one can use the Ovi Suite to connect to the internet. On linux, there is also a way by using wvdial and it took me a while to find out.

First of all, the connection is performed through a USB cable, so make sure you have one. (If you don't, like in my case, you can always search ebay for a cheap cable, I got mine for the 5230 for almost 4 euros included shipping charges!!!). Go ahead and connect the USB cable and select 'Nokia PC Suite' functionality from Nokia's pop up menu. Then open up a terminal and type:

lsusb

and you ll get something like that:

Bus 001 Device 005: ID 0421:02e3 Nokia Mobile Phones
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

The first line corresponding to your Nokia phone, has two numbers: 421 which is the vendor ID and 2e3 which is the product ID. These two numbers must be used in order to enable the serial connection through the usb cable from the connected phone. On that terminal type:

sudo modprobe usbserial vendor=0x421 product=0x2e3

In your case go ahead and replace the above numbers with the ones from your output.

Now, if you do not have wvdial installed, go ahead and install it (in debian-like linux distros):

sudo apt-get install wvdial

And now you are ready to start configuration for your modem. On the terminal type:

sudo wvdialconf create

The tool will try to identify the serial port the modem is connected and will make some tests in order to give you the final settings. Hopefully you will get a -not so small- list ending with something like this:

Found an USB modem on /dev/ttyACM0.
Modem configuration written to create.
ttyACM0: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

So, /dev/ttyACM0 is the device node that it is going to be used with speed 460800. Now, we will edit the options for dialing. Edit the following file with your favourite editor:

sudo vi /etc/wvdial.conf

 And enter the following:

[Dialer Defaults]
Modem = /dev/ttyACM0
BAUD = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=, ,"gint.b-online.gr"
Phone = *99***1#
Username = web
Password = web
New PPPD = yes
Stupid Mode = 1

Edit the above according to the setting that you received. Also, change the "gint.b-online.gr" according to your cell settings.

Save it, close it and then in terminal type:

sudo wvdial

And if you get the following:

--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Thu Apr 15 15:27:00 2010
--> Pid of pppd: 2975
--> Using interface ppp0
--> pppd: `(Q �1Q �(Q
--> pppd: `(Q �1Q �(Q
--> pppd: `(Q �1Q �(Q
--> pppd: `(Q �1Q �(Q
--> local  IP address 188.73.249.223
--> pppd: `(Q �1Q �(Q
--> remote IP address 10.6.6.6
--> pppd: `(Q �1Q �(Q
--> primary   DNS address 212.152.70.6
--> pppd: `(Q �1Q �(Q
--> secondary DNS address 212.152.70.7
--> pppd: `(Q �1Q �(Q

You are done!!! You have internet from your mobile and you can go ahead and start using the internet!

UPDATE:

The  above solution can be achieved through a bluetooth connection. First of all, you need to have bluetooth utilities installed on your machine. So make sure to install them.

After installing them, open up a terminal and type:

hcitool scan

This will identify all bluetooth devices that are in range. When your device shows up, use its MAC address to identify the channel for the rfcomm property (needed to access the modem):

sdptool search DUN

This will give you a list for the properties of your phone:


Inquiring ...
Searching for DUN on [mac address] ...
Service Name: Dial-Up Networking
Service RecHandle: 0x1001a
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 22
Language Base Attr List:
  code_ISO639: 0x454e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

Note the MAC and the channel number so that you may use it. Now we should create the rfcomm0 node so that it can be accessed:

sudo rfcomm bind 0 [mac address] [channel]

The device node has been created and now you can use it for dialup. Last step before dialing, you should change the modem property on wvdial.conf to:

modem = /dev/rfcomm0

And you are done!

Sources:  [1], [2], [3]

4 comments:

  1. works like a charm on a Huawei USB modem, thank you very much.

    ReplyDelete
  2. it works very nicely with E75 on ubuntu 8.04,thanks for making my day.

    ReplyDelete
  3. You dont need to do all this... it can be done in a few clicks - no need for any setups either. See the post - http://geekztips.blogspot.com/2011/01/using-mobile-phone-as-modem-to-connect.html

    ReplyDelete