This article is only going to be useful to a small number of people. If you don't have a Vodafone 3G USB stick, or you do but have no interest in using it on Linux, or you do but you've already got it working on Linux, anything below this paragraph is going to be of limited utility to you.

I own one of these.

Vodafone pay-as-you-go 3G dongle thing.

It's a pay-as-you-go Vodafone 3G USB dongle modem thing. The theory is you put it in your laptop anywhere in the UK and you've got internet access at a certain amount of money per gigabyte.

On the web there's a lot of information, and even more misinformation, on how to get this thing working in Linux. After appropriate wheat/chaff identification, I've found it's perfectly possible with ordinary Linux drivers and tools, and you don't have to use any proprietary software. I've got it working on my EeePC, which now runs Arch Linux after I got annoyed with Xandros' incessant bubble-mongering ("Your system has been plugged in." I know! Who do you think did it?). To save anyone else bashing their head against a wall, here are the settings that worked for me.

Preliminaries

First, I'll identify exactly what model of 3G USB stick I'm talking about, so that anyone who happens upon this information doesn't use it if it's not applicable. It's marketed as "Vodafone Mobile Connect". It's manufactured by Huawei, and lsusb identifies it as a "Huawei E220 HSDPA modem".

Also, the wvdial settings below apply only to the Vodafone network, in the UK, on pay as you go. Any other combination requires different settings.

Modem, meet Linux. Linux, meet modem.

If you want, you can use the Betavine Vodafone Mobile Connect Card (VMCC) Driver application instead of reading the rest of this article, if your distribution has the appropriate libraries available for it to work. For some people this isn't an option. For example, my EeePC has Arch Linux on it, whose Python implementation isn't compiled with UCS4 support, which the Betavine driver requires. Luckily, it's possible to get the USB dongle to connect to the internet manually.

I'm going to assume you've managed to activate the dongle as the instructions say. It's a while since I did that, so I don't remember the exact details, but I think you have to put the SIM card in a phone and make a call with it.

Getting Linux to recognise your USB modem as something that provides internet access is just a matter of sending the right commands to it. When I insert the USB modem, a device /dev/ttyUSB0 gets created. This acts like any other modem on a serial port. If you want you can fire up a terminal program such as minicom and spam AT commands to it. If you don't know what any of that means, just ignore it. /dev/ttyUSB1 might get created as well. The numbers might differ depending on what other USB serial devices you already have attached to your system.

If you don't get the /dev/ttyUSBn devices, maybe you don't have the usbserial module installed. Install it and try again.

wvdial

The package you need to talk to the modem is wvdial. Install that if it isn't already installed. You'll also want pppd - it's likely your package manager will insist on installing it along with wvdial if it's not already installed. After wvdial has sent your modem the appropriate incantations, pppd lets your system know that it can use the modem as a network interface.

Your /etc/wvdial.conf file should look something like this:

[Dialer Defaults]
Init1 = ATZ
Modem Type = Analog Modem
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Phone = *99***1#

[Dialer vodafone]
Username = web
Password = web
Baud = 460800
Stupid Mode = 1
Init2 = ATV1
Init3 = at+cops=3,2
Init4 = AT+CGDCONT=1,"IP","pp.internet"
Phone = *99#
ISDN = 0
Modem Type = Analog Modem

These settings worked for me. Once again, this is for Vodafone 3G pay-as-you-go in the UK; it's unlikely to work for anything else. The Init2 line, where it says ATV1, tells the modem to send verbose messages back. The Init3 line tells it to use HSDPA (otherwise known as 3G) rather than GSM or GPRS. Finally, the Init4 line with the AT+CGDCONT command on it tells the modem to make an internet connection using the access point pp.internet.

I've read many conflicting reports about what the Vodafone 3G access point name is for pay as you go customers in the UK, and most of them seem to be wrong. It's pp.internet. Not "internet", not anything dot vodafone dot anything, just pp.internet.

The username and password are web and web. It could be that you can put anything in here, I don't know. Either way, you don't need a username and password. Authentication and billing are accomplished by the fact that the mobile network knows what SIM card the call is coming from.

The dial string *99# tells the modem to make a data call. *99***1# seems to work as well.

Connecting to the internet

The wvdial.conf above describes a profile called vodafone. To initiate a connection, make sure the dongle is plugged in and run wvdial vodafone. I find I have to do this as root. It might be possible to allow a non-root user to run it after suitable manipulation of permissions and groups.

When you run wvdial vodafone, you should see output like this:

[root@scone graeme]# wvdial vodafone
--> WvDial: Internet dialer version 1.61
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATV1
ATV1
OK
--> Sending: at+cops=3,2
at+cops=3,2
OK
--> Sending: AT+CGDCONT=1,"IP","pp.internet"
AT+CGDCONT=1,"IP","pp.internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Thu Jan 14 21:11:18 2010
--> Pid of pppd: 1762
--> Using interface ppp0
--> local  IP address 10.97.67.181
--> remote IP address 10.64.64.64
--> primary   DNS address 10.205.65.68
--> secondary DNS address 10.205.65.68

Once you see it giving you DNS details as above, you should be connected. Run ifconfig and you should see a PPP interface:

ppp0      Link encap:Point-to-Point Protocol
          inet addr:10.91.91.86  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:118 (118.0 b)  TX bytes:157 (157.0 b)

You are now connected to the internet, without having to use the Betavine VMCC driver. To disconnect, I find giving the wvdial process a Ctrl-C works. There might be a cleaner way to do this.

Enjoy.