Linux Untetheredby Brian Jepson, coauthor of Learning Unix for Mac OS X Panther
I love Wi-Fi as much as anyone, but when it comes to total wireless freedom, nothing beats a cellular data connection. I signed up for unlimited CDPD service from Verizon Wireless a few years ago and had the pleasure of using the Novatel Wireless SAGE, a brick-like external CDPD modem that I got a lot of mileage out of. Unfortunately, it was basically two bonded 9600 bps modems, and was just awful without the compression software.
I'm sure you know what's coming next: I couldn't get the software to run under Linux (I'm lying — I did get it to work, just not very reliably, and it was a wretched hack). So I settled into acceptance of Windows NT as my main operating system, and spent most of my time using Linux under VMWare. It worked great, though; the compression software took the form of a two-tier proxy, one part of which ran on my localhost, so I had no trouble getting web browsers under my Linux virtual machines to talk to that proxy.
That was a long time ago. CDPD is pretty much dead (just try to find something other than postings about topless pop stars in alt.cellular.cdpd these days), and I'm not running Windows NT anymore. Most significantly (and what could be more significant than saying farewell to NT?!), cellular data has come a long way since CDPD: even GPRS is acceptable without compression software, but if not, some providers (T-Mobile and Sprint are the two I know of) have baked transparent compression into their cellular networks.
Cellular Networking Basics
In the United States and most of the world, the choice of providers usually comes down to GSM (Global System for Mobile communications) and CDMA (Code Division Multiple Access). Other protocols are still in use, but these are the leaders. GSM and CDMA have corresponding data protocols. With GSM, a cellular provider can support GPRS or EDGE:
- GPRS maxes out at around 40 kbps.
- EDGE is basically GPRS running on top of an enhanced GSM implementation and maxes out at around 144 kbps. It requires an EDGE-capable phone (such as the Nokia 6200) or PC Card (such as the Sony Ericsson GC82).
CDMA users have a choice of 1xRTT (1x Radio Transmission Technology), or 1xEV-DO (1x Evolution Data Only):
- 1xRTT speeds are about the same speed as EDGE (marginally faster in my tests).
- 1xEV-DO, the newest and fastest of the protocols described in this article, has been tested to perform at around 300-500 kbps.
(You'll see white papers and articles talking about much higher speeds for all these protocols, but they don't take into account the real-world constraints that cellular providers and users have to live with.)
Cingular and T-Mobile have GPRS deployed across all of their GSM networks; Cingular has limited support for EDGE, and AT&T's EDGE support is on much of their network at the time of this writing. Sprint offers 1xRTT on their CDMA network, and Verizon Wireless offers 1xEV-DO in two markets (although they are currently expanding 1xEV-DO across the U.S.), and 1xRTT over most of their CDMA network.
In the U.S., the typical rate for an unlimited data plan is $80/month. Depending on how much time you spend on the road, this may or may not be a good deal. It stinks for my needs, but there is one exception to this awful pricing. T-Mobile offers unlimited data for $30/month, but drops the price to $20 if you have a compatible voice plan. So I use T-Mobile with a total bill of around $60 a month (not bad for 1,000 voice minutes and unlimited data).
Unlimited data can mean different things. With the popularity of camera phones, users can move a lot of data across the network. Some companies, such as Sprint, have a cheap unlimited data plan for data sent from the phone. Some have used this plan for connecting a laptop to the phone, but others have pointed to dire warnings in the user agreement against doing this. My advice is this: if you're not supposed to be using your phone as a modem under your cellular plan, don't. Your cellular provider can do some very simple things to determine whether you're using it with your laptop (measuring the amount of data transferred, finding traffic on ports other than 80 and 25, and more), and they'd be well within their rights to stick you with a big bill for data used.
Making the Connection
There are a few ways to use your cellular phone as a modem. No doubt the coolest of all is Bluetooth, which lets you create a wireless serial connection between two devices. I'm not a fan of using Bluetooth for data connections. I loved it at first, but I've rarely been able to get a stable connection. I do most of my Bluetoothing on a Mac, and while file transfers, sync, keyboards, and mice work great for me, I can't get either of my Bluetooth phones to keep a data connection going for very long.
So I started experimenting with PC Cards and tethering phones with USB cables, and it has worked wonderfully. I had a data connection up not long ago with my Merlin G100 for 1 hour and 45 minutes, and experienced 5.2 Kilobytes per second (just over 40kbps) on a sustained download of an 8-megabyte compressed file. I used to go out of my mind when I tried that with a Bluetooth connection on either my Nokia 3650 or Sony Ericsson T68i. But I still swear by Bluetooth for things like sync, remote control, or transferring applications, ring tones, or wallpaper.
The trick to getting this all to work right is getting the phone to show up as a serial port. If you can't do that, you're not going to make a network connection without some kind of major hassle. The first wireless PC Card modem I ever tried with Linux failed miserably: it was a Sprint AirPrime PC3200 CDMA card that announced itself as some kind of USB port. I got as far as getting the USB port recognized, but whatever was attached to it was forever cut off from my Linux box. I've since had much better luck with other cards (or perhaps I'm not as dense as I used to be).
Novatel Wireless Merlin G100
This is the GPRS modem I described in the previous section. It's cheap (I've heard reports of $30 for this card on eBay, but I paid about $50) and works with T-Mobile. You'll probably find this card branded as VoiceStream (see Figure 1), the previous name that T-Mobile used. When I need to use this phone, I remove the SIM card from my cell phone and insert it into this card.
Figure 1. The Novatel Wireless Merlin G100 card.
If you have kernel support for PCMCIA serial devices (
CONFIG_PCMCIA_SERIAL_CS), you'll be able to plug this card in and have it appear as a serial port on your system (
ttyS02 at port 0x03e8, and
ttyS02 corresponds to
/dev/ttyS2). From there, it's
a simple matter of configuring a PPP connection. I used the following peers
/etc/ppp/peers/tmobile). You'll need to change the device
name to match what it is assigned on your own machine:
# File: /etc/ppp/peers/tmobile # /dev/ttyS2 # G100 modem 115200 # speed defaultroute # use the cellular network for the default route usepeerdns # use the DNS servers from the remote network nodetach # keep pppd in the foreground crtscts # hardware flow control lock # lock the serial port noauth # don't expect the modem to authenticate itself local # don't use Carrier Detect or Data Terminal Ready debug # Use the next two lines if you receive the dreaded messages: # # No response to n echo-requests # Serial link appears to be disconnected. # Connection terminated. # lcp-echo-failure 4 lcp-echo-interval 65535 connect "/usr/sbin/chat -v -f /etc/chatscripts/tmobile-connect" disconnect "/usr/sbin/chat -v -f /etc/chatscripts/tmobile-disconnect"
To connect to the Internet with a GPRS provider, set your Access Point Name
(APN) with the
AT+CGDCONT command. This is not strictly necessary
with all phones or modems, but it does avoid the problem you'll run into with
some providers such as T-Mobile. Your phone's default APN may restrict traffic
to ports 80 and 25 only. If you're paying for the full Internet service, use
internet3.voicestream.com APN (the former is NATted and the latter gets a public IP address). AT&T Wireless uses an APN named
proxy, and Cingular uses
isp.cingular. (Also, Opera
Software maintains a list of user-submitted carriers and APNs.) After you've set your APN, dial the number
To make the connection, I created the following chat scripts,
tmobile-connect chat script here demonstrates both setting the APN
and dialing the number:
# File: /etc/chatscripts/tmobile-connect # TIMEOUT 10 ABORT 'BUSY' ABORT 'NO ANSWER' ABORT 'ERROR' SAY 'Starting GPRS connect script\n' # Get the modem's attention and reset it. "" 'ATZ' # E0=No echo, V1=English result codes OK 'ATE0V1' # Set Access Point Name (APN) SAY 'Setting APN\n' OK 'AT+CGDCONT=1,"IP","internet3.voicestream.com"' # Dial the number ABORT 'NO CARRIER' SAY 'Dialing...\n' OK 'ATD*99***1#' CONNECT '' # File: /etc/chatscripts/tmobile-disconnect # "" "\K" "" "+++ATH0" SAY "GPRS disconnected."
To connect, I issue the command
pppd call tmobile as root and
press Ctrl-C when done:
debian:/home/bjepson# pppd call tmobile Starting GPRS connect script Setting APN Dialing... Serial connection established. using channel 2 Using interface ppp0 Connect: ppp0 <--> /dev/ttyS2 Cannot determine ethernet address for proxy ARP local IP address 184.108.40.206 remote IP address 10.6.6.6 primary DNS address 220.127.116.11 secondary DNS address 18.104.22.168 Script /etc/ppp/ip-up started (pid 9526) Script /etc/ppp/ip-up finished (pid 9526), status = 0x0
I chose this phone (see Figure 2) for a family member who seldom uses phones. The selling point was that it is cheap (around $100, if I recall correctly), and that it supports CDMA 1xRTT. I borrow it every now and then when I need a little extra speed, or when I'm writing an article like this one. Overall, I'm happy with the service, but I'm not clear on the terms of the data plan, so I don't use it heavily. As best I can tell, when I use a data connection, it comes out of the voice minutes, but this isn't spelled out anywhere in my plan.
Figure 2. The Motorola v120e CDMA phone.
You'll need the Motorola SKN6311B USB data cable to connect this phone to
your computer. You'll also need to have the USB modem driver
CONFIG_USB_ACM) compiled into your kernel or as a module. If it
doesn't load automatically when you plug the phone into your computer, you may
Dialing a CDMA provider like Sprint or Verizon Wireless is easy. Use
familiar AT commands and dial the number
#777. Unlike GPRS, you
don't need to set an APN. Unlike the previous example, Verizon uses a user ID (
your phone email@example.com) and a password
vzw). You can put this in your CHAP-secrets file, replacing
YOUR_CELLULAR_PHONE_NUMBER with the area code and phone number, as
4015551234 for (401) 555-1234:
# File: /etc/ppp/chap-secrets # # Secrets for authentication using CHAP # client server secret IP addresses YOUR_CELLULAR_PHONE_NUMBER@vzw3g.com verizon vzw *
The peers file,
/etc/ppp/peers/verizon, looks much like the
one I used for T-Mobile. Change the device name to match what the phone is
assigned and set
YOUR_CELLULAR_PHONE_NUMBER to match what you put
# File: /etc/ppp/peers/verizon # /dev/ttyACM0 # device # The following two settings need a corresponding entry in # /etc/ppp/chap-secrets. user YOUR_CELLULAR_PHONE_NUMBER@vzw3g.com remotename verizon 115200 # speed defaultroute # use the cellular network for the default route usepeerdns # use the DNS servers from the remote network nodetach # keep pppd in the foreground crtscts # hardware flow control lock # lock the serial port noauth # don't expect the modem to authenticate itself novj novjccomp # scripts for connection/disconnection connect "/usr/sbin/chat -v -f /etc/chatscripts/verizon-connect" disconnect "/usr/sbin/chat -v -f /etc/chatscripts/verizon-disconnect"
The following chat scripts dial the number and disconnect when you are done:
# File: /etc/chatscripts/verizon-connect # TIMEOUT 10 ABORT 'BUSY' ABORT 'NO ANSWER' ABORT 'NO CARRIER' SAY 'Starting CDMA connect script\n' # Get the modem's attention and reset it. '' 'ATZ' # E0=No echo, V1=English result codes OK 'ATE0V1' # Dial the number SAY 'Dialing...\n' OK 'ATD#777' CONNECT '' # File: /etc/chatscripts/verizon-disconnect # "" "\K" "" "+++ATH0" SAY "CDMA disconnected."
To connect, I issue the command
pppd call verizon as root and
press Ctrl-C when done. Sprint also offers 1xRTT service with the Novatel
Wireless Merlin C201 modem, which I've used under Linux (Sprint does not
require a user ID and password when connecting, but they do require you to
activate the card on a Windows machine prior to using it with another operating
Without a doubt, my preference is for the Merlin G100 card. It works on all the operating systems I use (Mac OS X, Linux, and Windows variants), and it gives me consistent speeds — but price is a huge consideration here. I suffer for my thrift: my testing has reached as high as 12.86 KB/sec for downloads on Sprint's 1xRTT network and 13.94 KB/sec on Verizon Wireless'. AT&T Wireless' EDGE network has given me download speeds as high as 11.31 KB/sec. That's a lot faster than the 5 KB/sec that I tend to hover at with T-Mobile.
However, rumors abound that T-Mobile is rolling EDGE out this year (2004). If they keep to their current pricing, it will be quite the offering, but don't ever do anything where you count on something you think a cellular provider plans to do. If you sign up for T-Mobile's service, do it with the expectation that you'll be getting 5 KB/sec for awhile. Because cellular service varies from place to place, be sure to take advantage of the 15- to 30-day buyer's remorse period offered by cellular providers. If it doesn't work out well, return it and try a different provider.
Even with the increased speeds offered by EDGE and 1xRTT, they aren't going to put Wi-Fi to shame anytime soon. However, they are valuable adjuncts for those times when you either can't find a hotspot, or when you don't need all that speed. I have Wi-Fi and broadband at home, and every time I take a trip, I'm amazed at how much work I can get done on GPRS. You'd think the Wi-Fi would spoil me, but I'm so happy just to get online wherever I want that the speed doesn't trouble me. I know faster speeds are coming: $80/month for around 100 kbps isn't such a great deal, but Verizon is offering 300-500 kbps for the same price on their 1xEV-DO network. That's not quite enough to attract hoards of people, but it's getting better, and it's probably just right for people who spend a lot of their time on the road.
Brian Jepson is an O'Reilly editor, programmer, and co-author of Mac OS X Panther for Unix Geeks and Learning Unix for Mac OS X Panther. He's also a volunteer system administrator and all-around geek for AS220, a non-profit arts center in Providence, Rhode Island. AS220 gives Rhode Island artists uncensored and unjuried forums for their work. These forums include galleries, performance space, and publications. Brian sees to it that technology, especially free software, supports that mission. You can follow Brian's blog here.
Return to LinuxDevCenter.com.