COVER STORYGPRS in LinuxMobile Internet access with GPRSANYTIME,ANYWHEREwww.sxc.huPermanent mobile Internet access might sound like a nightmare forsome, but for others it is a dream come true. All you need is Linuxand a fairly recent mobile phone. BY MARCEL HILZINGERGeneral Packet Radio Service(GPRS) is a communicationstandard for mobile phone networksthat is designed for efficient datatransfer. GPRS, which is typically fasterthan older, circuit-switched services, isnot intended for voice communicationbut is, instead, tailored for activitiessuch as email and web browsing overthe mobile network. One importantquality of GPRS is that it has the effectof being “always on.” You do not have todial a number in order to access GPRSservices.Many mobile phone networks nowoffer GPR Service to their users. A toolfor called GPRS Easy Connect bringsGPR Service to the Linux world. WithLinux and GPRS Easy Connect, you arejust one click away from mobile Internetaccess. The current version of this Perlprogram supports about 300 mobilephones and around 200 providers. You’llfind a detailed list of supported devicesand providers on the project homepageat .At present, the developers PéterSimon, Gábor Pintér and Andrea Bravettiare working on version 3.00, which isbased on GTK2 and supports UMTS andEDGE in addition to GPRS.Perl One…Installing Easy Connect should be quitesimple if you are using any of the currentLinux distributions. All you need inorder to use Easy Connect is Perl and theperl-Tk, perl-libwww-perl, and perl-URImodules. The Suse Linux DVD has thesepackages. Users with other distributionsmay need to download one of the threePerl packages off the Internet.Unpack the GPRS_Easy_Connect_253_Install.tar.gz package in a directory ofyour choice and enter su to become root(users with Suse Linux 9.2 or earlier cantype sux to do this). Now change to theGPRSEC_Easy_Connect_253_Install directoryand launch the install by enteringsh NSTALL. Click on Next, and confirmthe terms of the GNU Public Licensebefore going on with the install. Thenext window displays a list of softwarecomponents the program has discovered.If some of these components are taggedError, you will need to install the missingprograms. If you are looking formore details on dependencies, give thesh INSTALL -c command when launchingthe installer.After fulfilling the dependencies, clickNext and the installer will copy therequired components to their final destinations;you can then select Finish tocomplete the install.SetupWhen you launch the program for thefirst time, by pressing [Alt]+[F2] andtyping gprsec in the launcher, the mainEasy Connect window appears (see Figure1.) Click Setup GPRS Easy Connect toset up the mobile phone, provider, andconnection type (Figure 2.)Select your phone in the list at the top,and select your provider in Choose yourprovider. Easy Connect displays a pictureof the selected phone; this is a big help ifyou are not sure whether you haveselected the correct model from the list.When you select a provider, the programautomatically fills out your account data,such as your APN, user name, and password.These details are also availableon the web at  or directly from yourprovider.22 ISSUE 58 SEPTEMBER 2005 W W W. L I N U X- M A G A Z I N E . C O M
AdvertismentFigure 1: You need to set up the mobile phonebefore launching Easy Connect.Use the Select the portoption to select an interfacefor Internet access. The settingdepends on your connectiontype. For Bluetoothdevices, you will typicallyneed /dev/rfcomm0. (See thebox titled “Connecting yourphone via Bluetooth.”) Select/dev/ttyACM0 for USB connections.If you use a serialconnection between yourphone and your PC, enter/dev/ttyS0. If you use yourphone’s infrared port, select/dev/ircomm0. For informationmore on setting up Infraredconnections, refer to thearticle in this issue titled“Directory Services: Managingyour mobile phone withGammu and Wammu.”If your interface type is noton the list, check Expert portscan and select the correctentry. You can use the Selectyour languageentry if you preferto change theinterface language.Now clickon OK/Save Datato display the EasyConnect mainwindow again.The window has aConnect buttonthat should allowyou to connect.Easy Connect displaysyour IP address anddata transfer rate statisticswhen the connection is up.Usage and TricksFor initial tests, you shouldlaunch Easy Connect as root.This gives you access to both/etc/resolv.conf (nameserversettings) and to the PPP daemon(chat scripts).In our lab, our phone oftenreported problems with theBluetooth connection,although the connection wasactive. This can be an expensiveissue to resolve whenyou consider the price ofmobile Internet services. Toavoid unpleasant surprises,check your phone displayafter clicking Connect: mostphones let you know that aconnection has been established.For Bluetooth connectionswhere your phone isFigure 2: To set up the connection, Easy Connect needs details ofyour phone, provider, and interface.
COVER STORYGPRS in Linuxnot connected to your PC, you may evenneed to confirm the connection.The /sbin/ifconfig command gives youa list of active network devices. As GPRSuses a PPP connection, you should seean entry for the ppp0 device if the connectionis up. If you find this entry, youcan type ping www.kde.org to see if youcan contact the KDE project web server.At average GPRS speeds of 5-10 kbps, itcan take a couple of seconds for the firstresponse to start coming in. If pingresponds with an unknown host error,your nameserver settings may be false.Try to ping the KDE website using the IPaddress in this case:ping 220.127.116.11If the IP address works, you need anentry of the formnameserver IP addressto add at least one nameserver to the/etc/resolv.conf file. Check  for detailsof your provider’s nameserver.Now that you have successfully establisheda connection as root, you can dropyour privileges and repeat the experimentusing a normal account. Theaccount you use will need execute permissionsfor /usr/sbin/pppd. The systemadministrator can grant a user therequired permissions by entering thefollowing command:chmod +s /usr/sbin/pppdIn many cases, temporary problems canbe resolved by switching your phone offand back on.Unpleasant SurprisesEasy Connect makes child’s play of settingup an Internet connection via amobile phone. However, make sure thatINFO Project homepage:http:// easyconnect. linuxuser. hu GPRS access data:http:// www. taniwha. org. uk/ gprs. htmyour mobile Internet connection doesnot burn a hole in your purse.Most providers charge a monthly basicrate for the use of GPRS or UMTS – nomatter whether you just want to testyour connection using ping or download1 MB of data. Packages with larger trafficvolumes can cost up to 100 dollars permonth. GPRS traffic can cost up to 20dollars per MB of download volume.UMTS is cheap in comparison: expectto pay about 2 dollars per MB for UMTSservice, depending on your contract.Many providers expect you to sign a2-year contract in order to receive specialservices such as GPRS. ■Current distributions should have notrouble handling Bluetooth setup: simplyattach the USB dongle and launch theBluetooth system by entering /etc/init.d/bluetooth start (Suse and Fedora) or /etc/init.d/bluez-utils (Ubuntu). Suse Linux 9.3actually enables Bluetooth services automaticallyas soon as you attach anadapter. Typing hcitool dev will tell youif Linux has correctly identified yourdongle. The output from this commandshould show you the connected deviceand its Bluetooth address:marcel@kim:~> hcitool devDevices:hci000:10:C6:29:2E:15You can then enter hcitool scan to checkfor your mobile phone. Note that simplyenabling Bluetooth on your mobile willnot get your very far. The phone has tobe in visible mode. The following exampleshows that the program has detectedboth the phone (Z1010) and a PC(ubuntu-0):marcel@kim:~> hcitool scanScanning ...00:0E:07:BF:B4:C400:04:61:81:5C:6BZ1010ubuntu-0The last step is to set up a serial connectionwith the mobile; you need to be rootfor this. Again, you will need to run hcitool scan; note the Bluetooth address forthe phone (watch out for the additionalConnecting your Phone via Bluetoothnull between bind and the address):rfcomm bind 0 00:0E:07:BF:B4:C4If this command returns Connectionrefused, you probably need to pair thephone with your PC. To do so, enter afour (or more) digit PIN code in /etc/bluetooth/pin. Make sure the file containsonly the PIN code. Then restartthe Bluetooth service and launch yourmobile phone’s Bluetooth device searchfunction. If the phone prompts you forthe PIN code, enter the code from /etc/bluetooth/pin.To test the connection, become root andenter minicom -s; select /dev/rfcomm0 asthe port, and set the speed to 115200baud. Now type the AT command ATI tooutput your mobile phone name.The rfcomm command shows you theactive connections. To close the connectionto the PC, again become root andenter rfcomm release 0.Access Privileges: To open a connectionwith rfcomm, you must be root. Ofcourse, you will want to access the serialBluetooth port using a normal useraccount. To do so, first modify the permissionsfor /dev/rfcomm0. For olderLinux distributions that do not usedynamic device files, simply type chmod666 /dev/rfcomm0 to do this. More recentdistributions create the device file onthe-flywhen a Bluetooth adapter is connected.In this case, you can either resetthe file permissions every time youattach a Bluetooth device, or change theUdev settings for the device.To do so, open the /etc/udev/rules.d/50-udev.rules file in your editor,and add the following line (SuseLinux 9.3):KERNEL="rfcomm*", NAME="%k" UGROUP="uucp" MODE="0660" UOPTIONS="resmgr"For Suse Linux 9.2, open /etc/udev/permissions.d/udev.permissionsin the editorand add the following line:rfcomm*:root:users:0666Ubuntu already has a line that starts withrfcomm[0-9]*. In this case, you can simplyset the permissions to 0666. Userswith Fedora Core 3 don’t need to makeany changes. The /dev/rfcomm0 automaticallybelongs to the logged on userin this case.Automating connections: To removethe need to type the bind commandmanually, you can tell the Bluetoothsystem to bind automatically. To do so,edit the /etc/bluetooth/rfcomm.conf file.Change the bind no; entry to bind yes;,and enter your phone’s Bluetoothaddress in device 11:22:33:44:55:66;, forexample:device 00:0E:07:BF:B4:C4;Remove the hash sign at the start of theline, if any.24 ISSUE 58 SEPTEMBER 2005 W W W. L I N U X- M A G A Z I N E . C O M