If you have a mobile with GPRS enabled you can use it to connect your Linux Box to Internet. The program that we can use for this is wvdial. Most of the popular distributions will have it in its repository, if not, get it from here.
I am going to connect using:
Nokia E71
GSM based GPRS connection from Vodafone (India)
Kubuntu 9.04
WvDial 1.60
First connect your mobile phone with USB cable to your PC/Laptop. In the case of Nokia, four options will pop-up on the phone. PC Suite, Media Transfer, Mass Storage and Connect to PC to Web. Though I chose Connect PC to Web, it was not detected as a modem. So changed the mode to PC Suite on the phone, and then a modem was detected at /dev/ttyACM0. I got this message on dmesg - "ttyACM0: USB ACM device". Now we need to cerate a configuration file for wvdial. and save it to "/etc/wvdial-vodafone-gprs.conf" for the time being.
The file should start with:
[Dialer Defaults]
Add the basic settings for the modem.
Modem = /dev/ttyACM0
Modem Type = USB Modem
Baud = 460800
For any gprs connection the most important detail you need is the APN ( Access Point Name ) of the service provider, in the case of Vodafone, it is "portalnmms". This should go in the modem initialization commands as below:
Init1 = ATZ
Init2 = AT+CGDCONT=1,"IP","portalnmms"
Note that the APN is part of the Init2 command. Now we need to add the dialing phone number, username and password. This is same across all GSM providers (CDMA phones have different values).
Phone = *99#
Username = 0
Password = 0
Dirty Secret: GSM don't check the username and password for authentication, it just needs the entries to be present in the configuration - with some junk values.
Save the file and dial with wvdial command using /etc/wvdial-vodafone-gprs.conf as an argument:
safeer@penguinpower:~$ sudo wvdial -C /etc/wvdial-vodafone-gprs.conf
You will get a lot of output, look for the following lines ( the IP's shown may differ)
local IP address 10.16.25.127
remote IP address 10.6.6.6
primary DNS address 10.11.230.2
secondary DNS address 202.144.13.50
This indicate the modem is connected. At this point you will be able to contact your DNS server and resolve names. But you need to set proxy for your browser to start browsing. For Vodafone the proxy and the port are 10.10.1.100 and 9401. Set this on your browser and you can start browsing. When you are done, close the connection by pressing Control+C to terminate wvdial command.
If your connection is CDMA, the phone number will be #777 instead of *99#, and the username and password will be your mobile number ( without country code ). Also the Init2 string will be "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0" (no APN name).
A few more things to note, depending on your phone, the modem device location may change, it can be /dev/ttyUSB0, /dev/ttySL0 etc... always check dmesg to see how it is detected - use command dmesg|tail after connecting your usb cable.
For good measure, you can add the following settings as well to the wvdial configuration:
Dial Command = ATDT
Stupid Mode = 1
ISDN = 0
New PPPD = yes
To find out your provider's GPRS settings, you can visit Manoj Tivari's blog . I got the Vodafone proxy details from this web site.
Good post! Helped to finally connect my Samsung phone to gprs. Thanks!
ReplyDeleteyes, great help showing the right configuration for wvdial. The only change I have in my setup is instead of "portalnmms" I use "www" since I have Vodafone mobile connect.
ReplyDeletedude u have just saved my life ! way to go
ReplyDeletejust want to say that you need to change the apn to www as said above for vodafone 3g too :)
and the speed is great I can download at 200k per sec the only problem is data caps at 3 gb :( maybe my year 2030 we sud solve that too