Get mobile broadband on your Linux laptop

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{interface}=="Data Interface"
ACTION=="add", RUN+="/usr/sbin/pon"