HOWTO Setup GPRS/UMTS Access On a Mac

I've been using mobile data with my s for years now, but so far I've yet to compile a moderately decent guide to getting online with using and/or /UMTS services (which seems kind of odd until you realize that my preempted me from doing so when it was most relevant...).

This is a first attempt at doing so in a way that most people will understand without having to reach for the nearest geek for translation, and as such is likely to be woefully incomplete, but like most of the s on my site, it's likely to be reviewed periodically.

I've written it for users (and bear in mind that I only use on my s) but the basics should be applicable to pretty much every OS. However, other platforms do their own thing where modem management and dial-up connections are concerned, so your mileage will vary.

The Basics

One thing you should know for the outset is that so far most mobile data devices are little more than souped-up serial ports atop which you set up a PPP connection.

There is a better way (see the Bluetooth PAN section below), but it is not yet widely implemented, so the serial port approach is still very relevant indeed.

It is both a hangover from dial-up days and a way to ensure a very simple, universally accepted data link layer for any type of device that requires mobile access. The only real novelty is that as mobile networks evolved, the mobile phone started emulating part of the PPP connection setup as well as having a few more ways to specify what sort of data connection it is requesting from the mobile network.

But it all still looks (and feels) like a regular dial-up connection configuration-wise, which means there is only a limited number of ways to go about setting up things.

So, What Do I Need?

Well, besides a mobile data plan, you need:

  • A standalone cellular modem, mobile phone or data card
  • A driver, modem script and/or setup application for it
  • Your service provider's configuration (usually a username, password and APN).

Let's start with the configuration, since that's where most people have the most problems.

So, what's an APN?

Simplifying matters, an APN is a logical label for a service profile, something that determines what services you are accessing on the operator's network.

Some operators set up different APNs for different services (WAP, MMS, internet access, etc.), while others share APNs among services - which has been a common strategy for a few years, as it greatly simplifies user configurations and support.

Think of it as a way for the operator to figure out what sort of connectivity they're going to provide you with (what kind of IP address, bandwidth cap, what sort of QoS, etc), and as the configuration setting you don't want to get wrong.

Now, setting up a standard dial-up connection usually requires three things: the username, the password and the access number, but since APNs are usually names (like internet or wap.provider.net), what do you do with them?

Well, that's where you start getting into the legacy dial-up emulation stuff. GSM and defined a set of AT Commands that let you access packet data services by "dialing" a service code starting with *99.

What actually happens is that the modem inside your phone or data card picks that up and starts setting up a data connection to the required APN, handing over the rest of the PPP setup to your computer once the radio/QoS stuff is figured out.

But how do you specify the APN? Well, most devices will invoke a "default" packet data service when you dial *99#. But that is not likely to be useful, so you usually have to set up the APN via AT Commands or menus.

And that's what dial scripts are for in - they set up the data modem and specify the APN.

A Typical Dialogue

Let's imagine you've got a very simple, very dumb cellular modem. No menus, no user UI besides a serial port (or a serial port atop a or Bluetooth connection, which is what you'll get most of the time).

Here's what happens at the serial port when you connect to the internet APN via your service provider:

# First, the Mac will ask the modem to reset (the simplest case is shown)
ATZ
# ...and we'll get an OK reply.
OK
# Then we set up the APN and bind it to a connection identifier (CID for short):
AT+CGDCONT=1,"IP","internet"
OK
# Now we dial CID 1 specifically (instead of the default *99#)
ATD*99***1#
CONNECT
# and then comes the PPP negotiation, which normally goes
# straight to binary data.

Notes: Lines with a hash in front are annotations so that you can figure out what's happening, and don't really occur. And do not use CID 1 without being absolutely certain it's not being used by your phone for its WAP profile. Read below for more.

You can see most of this for yourself by invoking the Connection Log menu in Internet Connect or watching /var/log/ppp.log in Console - although you might have to enable PPP debug by adding a line containing the word debug to /etc/ppp/options - but don't worry about that unless you're a geek (in which case you're more likely to have skipped to the next section already).

But if you want to try your hand at it, get - it's the quintessential  terminal emulator, and gives you a nice drop box to pick out your modem from.

Modem Scripts

So, what a modem script does is pretty much tell what sequence of AT Commands resets the modem and sets up the packet data link.

Then something else like Internet Connect will grab the script, activate the cellular modem (by accessing it through or Bluetooth) and use the instructions in the script to hook you up to the Internet.

Modem scripts live (predictably) under /Library/Modem Scripts, and they're pretty standard text files written in a simple language. To add support for a specific modem, you simply drop in the relevant script, and since they're text files, you can even roll your own.

I used to use Ross Barkman's scripts for and UMTS, but of late I've found that there is now a modem script for the Vodafone VC701SI bundled with that seems to work with most of my SonyEricsson and Motorola phones.

The reason why it does work is that it is pretty simple and does not issue any vendor-specific AT Commands, but it is not guaranteed to work with all devices - so if it fails, you may need to try other built-in scripts for devices similar to your own or take a closer look at Ross'.

Setting up Specific Modem Types

And how do you set these up, then? Well, it is very much dependent on what you have. I'll try to provide a short but comprehensive overview in this section (and include some links to specific documentation as necessary, to keep things readable).

Cellular Phones

There are far too many ways to configure mobile phones as modems, but they remain my favorite way to have mobile connectivity, because:

  • There's no mucking about with PIN numbers in AT Commands - you've already entered the PIN code to switch the phone on.
  • They usually display a clear indication of coverage and connection status (something you won't always get with other devices).
  • They have a built-in battery - which means they don't drain your laptop's (unless, of course, they happen to charge via , and even then they tend to use far less power than a data card).
  • Bluetooth models can be used as "access points" when you don't have good coverage where you're sitting (I usually place mine on the windowsill).
  • UMTS models will let you take a voice call while connected without any impact - the phone will simply downgrade the data connection to 64kbps and keep the data flowing while the voice call is in progress, unlike what you'd experience under (in , phones with "dual transfer mode" can do the same, but others will suspend - or even drop - the data connection while the call lasts).
  • It is far easier to set up a phone using either or Bluetooth in just about any operating system than having to deal with a data card.

As to the configuration itself, it is wildly varying across manufacturers and even between specific models, so I'll stick to some ground rules:

  • Modern Nokia Series 60 phones will let you define a default data connection where you just need to write the APN name. Look under the "Connection" options in Settings (or something to that effect) for a place to define the "access point". You then use your computer to dial *99# (without setting any specific APN via AT Commands) and the phone will use the APN you typed in.
  • SonyEricsson phones usually come with many data connections pre-defined by operators - which means that CIDs 1-4 are already likely to be in use for WAP, MMS, Internet access, etc. To figure out which one to use for Internet Access, go into Settings, Data comm., Data accounts, choose the Internet account (if it exists) and then use the More|Account Info menu - the phone will tell you the APN name and an "External ID", which is the CID number you have to use (i.e., if the External ID is 3, you have to set your computer to dial *99***3#). This way, there is also no need to select the APN via AT Commands.
  • Motorola phones are, sadly, anyone's guess. Most of them seem to require setting the APN via the CGDCONT AT command above, but there have been many changes.
  • Samsung phones can work both ways (and their UMTS phones make excellent modems), but they too have pre-allocated CIDs.
  • Huawei modems just plain don't care. As long as yu use CGDCONT to set the APN, they're game.

The most frequent mistake people make (and one that I've repeatedly made myself when dealing with SonyEricsson phones in the early days) is to overwrite an existing phone profile via the CGDCONT command, thereby rendering their WAP profile useless.

So before you try anything, make sure you can either identify which CIDs are taken in your phone - it will save you some time later on if you happen to make a mistake and need to call your operators' support centre.

Data Cards

Data cards have been one of the most successful ways to access the mobile internet of late, and they are usually PCMCIA/PC Card-format devices that, in the end, present some sort of serial interface to the computer.

Update: for some Novatel data card models in .

Ironically, some of them are even PCMCIA-to- bridges, with an internal hub inside and several serial ports hanging off it. The most common configuration is to have one for the data connection itself and another (sometimes with a set of proprietary commands) to retrieve card status information, such as whether or not it's registered in the network, etc., so everything I've described so far also applies to them.

The biggest issue with data cards from a configuration standpoint is that you have to either remove the PIN code from the SIM card you're using with it (bad idea) or enter the PIN via the AT+CPIN="digits" command:

ATZ
OK
AT+CPIN="1234"
OK
AT+CREG?
1
AT+CGDCONT=1,"IP","internet"
OK
ATD*99***1#
CONNECT

Note: AT+CREG? checks if the modem has registered successfully after you activated the SIM card by entering the PIN, and is not really necessary unless you want to write a "clever" modem script.

Mobile operators and card manufacturers usually provide you with some sort of application to do all of the above for you (as well as monitor signal levels, keep track of your traffic consumption, etc.), but it pays to understand what it's doing under the hood.

Personally, I have had a wide range of experiences (not all of them positive) with data cards on Windows (usually due to IRQ conflicts with built-in laptop hardware), and have yet to spend a significant amount of time using one under due to the plain and simple fact that none of my own s has a PCMCIA slot, but by and large I prefer avoiding them.

Standalone Modems

These lie somewhere in between the hassles of using a data card and the ease-of-use of a mobile phone, but usually have a few extra perks. For instance, some models have built-in LCD displays and connection on/off buttons to make it easier to manage the connection, and most have coaxial connectors for external antennae.

But despite being far less popular than the other two alternatives above, they still answer to AT Commands and follow the same basic rules, so they shouldn't present any real problems.

Cellular Routers

This is a new category, the current epitome of which is the MiFi.

The advantages are obvious: Zero setup required on your (other than plugging in a cable or configuring the Wi-Fi connection properly), but, like all routers, it requires some extra effort to set up, and (up until recently) needs to be tied down to a power socket...

Nevertheless, it still uses the same basic parameters, i.e., somewhere in the router configuration, you'll have to set up a username, a password and an APN - it has a built-in data card, so underneath the web interface its little core it is still using AT Commands to talk to the card's serial port...

Bluetooth PAN Gateways

Of course, there's always an easier way. If you have a mobile device that supports the Bluetooth Personal Area Network mode, it will work as a LAN-like interface over Bluetooth (from onwards.

Here is a little piece explaining how.

Basically you pair your Bluetooth device with your , and you'll get an extra option in the Bluetooth menu. Selecting it will make your phone connect to the Internet and act as a dedicated gateway, but without any configuration on your - everything is done on the device.

On SonyEricsson devices, you will have to define all the connection settings on your phone (go to "Connectivity", "Bluetooth", "Bluetooth Internet" and pick an access profile - which is where you input the username, password and APN).

Whether using PAN or standard dial-up via Bluetooth, HSDPA users will be capped by Bluetooth data rates (EDR won't go beyond 2Mbps rather than the 700-odd Kbps of the base norm), but that is an acceptable compromise considering the convenience.

The Actual Setup

After all the above, you should feel fairly confident to try setting up your mobile data connection, but here's a checklist to keep you going:

  • First off, make sure you have the username, password and APN parameters from your provider.
  • Make sure those are Internet settings. If they designate a proxy or gateway, they might well be WAP settings. Double-check, there's no harm in asking.
  • If you'll be using a phone, set it up using the Bluetooth wizard. When prompted for a modem script, try the "Vodafone VC701SI" if you have no other suitable option (don't worry, you can change it later).
  • Bluetooth PAN devices will show up on your Bluetooth menu immediately after pairing - all you need to do is make sure the Personal Area Network settings are correct on the phone.
  • If you're using another device (or a phone connected via ), when you go to System Preferences and pick the Network preference pane you should get a warning about a new port being detected. This also applies to data cards - except when you use the card's own software, which should do this for you.
  • If you have to use dial-up, figure out the right CID to use. If you have a Nokia phone, try setting the APN name as explained above and use #99* as the access number.
  • Configure the connection (the Bluetooth wizard prompts you for it, use System Preferences or Internet Connect to create a new connection on non-Bluetooth devices):
    • Set the username, password and "number" (the *99***CID# combination).
    • Hit "Connect". You should be all set.

Finally, learn how to use the Location preferences - these can save you a lot of time, and it pays to have a "Nomadic" Location with your mobile connection defined (that way you can re-configure your with a single click).

Troubleshooting

Finally, here are a few useful tips in case you have trouble connecting:

  • Again, make sure you're using the right CID and/or that you're not overwriting (or attempting to overwrite) any of your phone/modem's built-in profiles.
  • Disable the wait for dial tone before dialing option for your dial-up connection (dig into the modem properties in System Preferences or Internet Connect)
  • Try disabling IPv6 and changing the compression/authentication settings for your connection.

But whatever you do, try doing each change at a time. Grab a piece of paper and take notes, it's nothing to be ashamed of.

That's it for now. If you find this useful (and please remember that I am not responsible for any mistakes, mis-configuration or mobile data charges you may incur on by following the above) , please consider donating towards my gadget money - is coming. :)

This page is referenced in:

  • HOWTONov 18th 2006