Get broadband on the move with Linux


Mobile telecoms companies are now pushing "mobile broadband" in the form of a connection that uses the 3G mobile phone networks. While the bandwidth available can be variable, you don't need massive bandwidth for most tasks, as long as it has sufficient throughput for the main business tasks: email, Facebook and YouTube. That leaves us a few questions. Has mobile productivity come of age? How do these systems work? What sort of coverage and speeds do they provide? Most importantly, do they work with Linux?

We're going to try to answer all of these questions, using the USB mobile broadband dongles provided by three UK mobile telecom companies: O2, T-Mobile and Vodafone...

All the USB modems we looked at also support the older, slower technologies, like GPRS, and will fall back if an HSPA connection is not available. It is also possible to get HSPA modems on mini-PCI cards, suitable for fitting inside a laptop. Some manufacturers offer this as an option (one of our Dell laptops has such a card).

Providers and packages

All of the UK mobile telecom providers now offer a range of mobile broadband packages. In addition to the coverage, which is increasing all the time, the main differences between the contracts are monthly charge, contract term, download limits, excess download charges and modem cost.

The longer or more expensive the contract, the more the cost of the modem is subsidised. The providers mainly offer packages with 3GB or 5GB per month limits, but watch out for the costs of going over that, as they can be quite heavy.

There are also pay-as-you-go options, but some of these are charged per day, so occasional light use can get quite expensive. If you don't need a modem, some laptop manufacturers offer the option of an internal HSPA card, make sure you ask for a discounted price, as even those packages where you pay for your modem subsidise the cost from your monthly charge.

There are also some extras and off ers available, and these change all the time. At the time of writing, T-Mobile and O2 are including Wi-Fi access through their hotspot networks, and Three is offering a 50% discount to its existing phone subscribers.

We contacted all the providers, and three of them - Vodafone, O2 and T-Mobile - provided us with hardware to test their services. Vodafone is the only company to provide Linux software for its mobile broadband services - more on that later.

We were supplied with three modems from two different manufacturers, O2 sent us a Novatel MC950D modem while T-Mobile and Vodafone both use the more popular Huawei modems. There are a few different models from Huawei, differing in form factor (some are a small box with a short USB cable, others look like a large memory stick), maximum speed and bands covered but all working in the same way.

Some have a micro SD card slot, in addition to the SIM card slot, so that they can be used as a memory stick too. Maybe some enterprising hacker has already put a bootable Live distro on to one of these to give a complete, connected system on a device slightly larger than a standard flash drive.

There are also mini-PCI card modems available, some supplied as options by laptop manufacturers, which work in the same way, though you may have to search Google to determine the correct driver.

The devices each have a single, multi-colour LED, often of the hidden type that is currently fashionable. These give information on the type and status of connection by their flash rates and colour. For example, the Huawei modem flashes quickly while initialising, slowly when it has detected a network but is not connected and becomes steady when a PPP connection is established.

The LED glows blue when it has a 3G connection and green when it drops to GPRS. These devices get very hot in use; this is indicative of the power they draw, so expect battery life to suffer when working online.

Novatel MC950D

This modem requires the option kernel driver. Yes, there really is a kernel module called option, as opposed to module options - no scope for confusion there then. If you're using a standard distro kernel, this should already be present but if you roll your own kernels, make sure you enable the option option, and make it a module, not built in.

In common with the Huawei devices, this modem appears to the system as a USB CD-ROM drive when you first connect it. The idea is that when you plug it into your Windows laptop, the 'CD-ROM' autoruns and installs the drivers. After that, the presence of the drivers means that the device appears as a modem instead. On Linux, there are no drivers to be installed, as they are part of the kernel, but the modem device does not appear until the CD-ROM has gone away.

If you run lsusb after connecting this modem, you'll see a single entry for it with an ID of 1410:5010 - that's the CD-ROM. If you then eject this CD, either by using whatever method your desktop offers or by running eject /dev/cdrom (or wherever this pseudo-CD appears) the lsusb output changes, the old ID disappears and a new one shows up - 1410:4400. At this point, dmesg should show the option and usbserial modules being loaded and a new device appearing, /dev/ttyUSB0.

Having to manually eject the storage part of the device i n order to make the modem to appear becomes a chore after a while, but the Novatel modem has different USB IDs for its two sides, and we can block one with a simple udev rule. Add one of these lines to /etc/udev/rules.d/10-local.rules, creating the file if it doesn't exist:


ACTION=="add",RUN+="/usr/bin/eject %k"

The first is preferable, if it works on your device, as it completely ignores the device. The second option forces an eject as soon as it appears. Use lsusb to determine the correct IDs.

One the CD-ROM disappears, a new device appears, /dev/ttyUSB0 (the number may change if you have another usbserial device connected, such as a Palm). Now you can treat the modem as you would a dialup modem and use your favourite PPP program to connect. For example, in KPPP, create a new modem, set the device to /dev/ttyUSB0, flow control to 'hardware' and the modem initialisation string to 'ATZ'.

A web search turns up various init strings; AT&FE0V1X1&D2&C1S0=0 was a favourite, and you can try it is you wish, but a plain ATZ that sets the modem to its defaults works as well as anything else here. You can set the speed to either 460800 or 921600, but it made no difference to download speeds. Remember this is not really a serial modem, even though you are treating it as such.

Then create (should that be Kreate?) an account in KPPP, set the phone number to *99***1# and authentication to PAP/CHAP. The username and password can be set to anything you like - we used "web" for both. Authentication is provided by the SIM card in the modem, so you can leave everything else at the defaults. Press Connect and your modem should be online in a few seconds.

Username, password and connect speeds are irrelevant, so most settings in KPPP or other diallers can be left at the default.

Huawei modems

The various Huawei modems used by Vodafone, T-Mobile and others all work identically as far as configuration and usage are concerned, and much of this is the same as with the Novatel device.

The main difference is that you do not need to get rid of the pseudo-CD-ROM before the modem is available, as both devices appear when you connect the modem. In fact, three devices appear: there's a /dev/ttyUSB1 control channel too, but this is not needed when using standard dialler software.

You may still want to use a udev rule to ignore the CD device, to prevent your desktop annoying you with notifications that a device has been detected and asking you if you want to mount it.

Once again, these modems use the option and usbserial drivers so much all of the previous section applies here too. If you prefer Gnome to KDE, you can use Gnome PPP to handle the dialling duties. The settings are the same, and even the phone number is the same at *99***1# for all the providers we tried, because you aren't really dialling a number.

The dial command just tells the modem to connect, the 1 at the end telling it to use the first profile. Most modems have only one profile but this option may be useful in the future. You can also use Wvdial to connect, which actually works faster than either of the GUI diallers.

You need to create the configuration in /etc/wvdial.conf or ~/.wvdialrc. This worked with any of the providers we used:

[Dialer t-mobile]

Modem = /dev/ttyUSB0

Baud = 460800

ISDN = 0

Modem Type = Analog Modem

Phone = *99***1#

Stupid Mode = on

Username = anything

Password = anything

Then you can connect with the command wvdial t-mobile

where the argument given to Wvdial matches a Dialer stanza in the configuration file. The Stupid Mode line tells Wvdial to go straight for a PPP connection without listening for any login prompts first.

This is not a necessary step, but it does speed up the login greatly. If you have any problems connecting with Wvdial, try setting this to 'off' before you try anything else. You can attach this command to an icon, menu item, launcher button or whatever is supported by your desktop of choice.

A further alternative is to use pppconfig to generate a configuration file for pon and poff, run this in a terminal as root (or with sudo). Take the options to use dynamic DNS and CHAP authentication and give the details as used in the Wvdial example (only the device, phone number and speed are important this time), and when it asks you for a name to save as, use "provider".

While pon and poff can connect to any named provider saved by pppconfig, if you run them with no name, it uses those settings saved as "provider". Once you have set this up, you can connect with sudo pon and disconnect with sudo poff.

As with Wvdial, these commands can be run in a terminal or attached to your favourite GUI launching method. Pon has to be run as root, so you may prefer Wvdial, but pon comes in useful in the next section.

Hotplugging with udev

You may feel that all this messing around with launching diallers to connect should be unnecessary. After all, why else would you plug in the modem except to connect to the internet? Wouldn't it be better if the thing just connected when you plugged it in? Yes, it would, and the wonders of udev make this possible.

In addition to doing things like ignoring the CD part of the device, as above, udev rules can also be used to run commands or scripts, so you could add something like this to your udev rules file:

DRIVERS=="option", ATTRS=="Data Interface"

ACTION=="add", RUN+="/usr/sbin/pon"

This will work with any modem that uses the option driver, or you could tie it to a specific modem by using idVendor and idProduct matches. Details of how to write udev rules are beyond the scope of this article, but you can find detailed information on the topic at

Software requirements

There isn't any specific software needed to use mobile broadband beyond the driver, which is usually included with the Linux kernel, and one of the PPP dialler programs, all of which use the standard pppd software to handle the connection.

If you want to monitor the status and throughput of the connection, one of the many system monitoring tools will do the job. We use Gkrellm for this, as it keeps everything in one fairly small window, but any network monitoring tool will do the job. Some of the dialler programs also include an option to display connection information.

The Vodafone software provides useful monitoring of bandwidth usage, and warnings when you near your limit.

As bandwidth is limited according to the package you buy and charges for exceeding this can vary from zero (although speed is reduced) to £10 per gigabyte, it makes sense to keep an eye on overall throughput. A useful program for this is vnstat, which collects information from each interface via an hourly Cron job. After you've initialised the program with

vnstat --update --interface ppp0 will keep track of your upload and download usage. You can get a report at any time with

vnstat --months --interface ppp0

...which shows a monthly report of your traffic. Replace --months with --weeks, --days or --hours for shorter-term reports. Because this relies on a Cron task running every hour to record the stats, it is not 100% accurate, as when the modem is disconnected, the ppp0 interface disappears, so any traffic since the last update is not recorded. However, it can still give you a good guideline.

You could improve the accuracy by shortening the interval at which the Cron task is run to, say, ten minutes. The providers generally have some way of checking your network usage on their website, but it is convenient to be able to make a quick, albeit somewhat rough, check without using up any more of your precious bandwidth in the process.

All of the modems come with drivers and utility software for Windows. Linux drivers are not needed as they are part of the kernel, but what about utility software? The only company to provide software for Linux is Vodafone, with its succinctly named vodafone-mobile-connectcard-driver-for-linux package, which we will refer to as vmc from here on to save on trees.

Despite the name, vmc works with any of the modems and providers. You can download vmc from by following the Files link on that page.

Installation is a little involved, mainly because of the number of dependencies brought about by its use of the Python Twisted framework. There are packages for a number of distros available from but these are slightly older. The first link has the latest version. The instructions given with this are for Ubuntu only, but should work with most other distros, although some will need to drop the use of sudo and use a root terminal instead.

The first step is to make sure these packages are installed:

  • python-dbus
  • python-twisted
  • python-serial
  • python-glade2
  • python-pysqlite2
  • wvdial
  • python-notify
  • python-gnome2
  • python-gnome2-extras
  • python-serial
  • hal
  • python-tz
  • python-setuptools

These packages are desirable but not necessary:

  • bluez-gnome
  • python-gnome2-desktop

If you are happy using the command line, the quickest way to make sure everything is installed is with a single command. Take a deep bre ath:
sudo apt-get install python-dbus python-twisted python-serial python-glade2 python-pysqlite2 wvdial python-notify pythongnome2 python-gnome2-extras python-serial hal python-tz python-setuptools bluez-gnome python-gnome2-desktop

This is given in the INSTALL file, so you can paste it from there instead of having to typing it out. Note, however, that pythonsetuptools is not listed in the INSTALL file despite being required by the installer. Users of other distros should look for similarly named packages in their package manager.

The next step is to set some permissions with this:

sudo chown :dialout /etc/ppp/ peers

sudo chmod g+rw /etc/ppp/ peers

sudo chown :dialout /etc/ppp/*- secrets

sudo chmod g+rw /etc/ppp/*- secrets

These commands make sure that the files and directories used by Wvdial are writable by members of the dialout group. You may also need to add yourself to this group using your distro's user manager or with these commands:


sudo gpasswd -a myusername dialout

The first command lists the groups you belong to - do not run this as root! If 'dialout' is not listed, run the second command, which needs root access, to add your user to the 'dialout' group. You will need to log out and back into your desktop session before this change takes effect. Debian users should add themselves to the 'dip' group in the same way, and Fedora users need to be members of 'uucp'.

Once this is done, unpack the archive, enter the project directory, read the installation instructions to make sure you have completed all of the pre-installation steps and run the installer with:

tar xf vodafone-mobile-connect-card-driver-for-linux-2.0.beta3.tar. gz

cd vodafone-mobile-connect-card-driver-for-linux-2.0.beta3


sudo python install

The INSTALL file implies that this is all that is needed, but there is an extra step to compile a utility program. This needs a compiler toolchain installed, which you usually get by installing the build-essentials package. It also needs libusb-dev installed.

The contrib directory contains three subdirectories - use e220 for all Huawei USB modems - while the ovation directory contains files for Novatel modems. These are udev rules and a utility program to switch the device to modem mode instead of CD-ROM. Enter the correct directory then build and install the files with:

cd contrib/e220


sudo make install

This installs huaweiAktBbo to /usr/sbin. This is the program that initialises the modem, disabling the CD side of the device and enabling the control connection on /dev/ttyUSB1, with /dev/ ttyUSB0 staying as the serial connection for the modem. It also installs a custom udev rule file that calls /usr/sbin/huaweiAktBbo when the modem is connected. It is not necessary to run huaweiAktBbo for normal PPP usage with a standard dialler program, but it doesn't do any harm. It is needed by vmc, but you can build this part without vmc just to initialise the modem, in which case you do not need the long list of dependencies.

Run vmc by typing vodafone-mobile-connect-card-driverfor-linux in a terminal (we're sure you will quickly add it to your launcher to save wearing out your keyboard/fingers). The first time you run it, it looks for a modem and asks you for the configuration options, the defaults all worked fine with Vodafone.

It seems like a lot of trouble to install this software, you are probably wondering why you should bother when any of the normal PPP programs will work. The reason is that doing it this way this does more than just connect to th e internet. It provides usage information, with an option to warn you when you exceed a threshold, and SMS management, so you can write text messages in real words on a proper keyboard.

After installing Vodafone Mobile Connect from the special Eee repository, it appears on the desktop.

Vodafone did point out that the company is not directly supporting Linux drivers for their devices, but that the Vodafone Group is supporting the open source development of this software. This is the best approach for us, because it means that the company is putting resources into Linux development and the product of that investment is available to everyone, and always will be. The Betavine Forge website is worth a visit by anyone interesting in mobile developments.

Returning to our original questions: is the coverage and speed there? Yes it is. Maybe not as an alternative to a fixed-line broadband connection, but very good for mobile use. Does it work with Linux? Yes, and very well once you get it set up, which will be easier once Vodafone's software comes out of beta. Even so, using standard diallers is relatively simple.

First published in Linux Format magazine

You should follow us on or Twitter

Your comments

did all usb modem are same??

i wanna ask alittle,
did all usb modem(brodband) using the same linux code?
i mean the way we want to connect it to the internet.
iam using P1 Wimax(malaysia) wiggy broadband modem..
and how do i make the driver or mae it work fine???

iam just a rooky but seeking for knowledge in linux...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Username:   Password: