This was originally posted on 2009-08-11 to http://andrewho.co.uk/weblog/debian-powerbook-g4-vodafone-payg-usb-modem-k3565
I frequently find myself in need of mobile internet, and for this I use a Vodafone PAYG USB modem. It's the best plan in the UK, mostly due to the fact that the bandwidth doesn't run out. I pay £15 for 1 GB, but that 1 GB never expires and given that it'll take me about two years to get through that it's a pretty good deal (I mostly just SSH a terminal out).
The model I bought about a year ago is the Vodafone K3565, which I believe is a
rebranded Huawei E160. This device can function in two different "modes": as a
storage device (it also contains a microSD slot) or as a modem. Some people
report having to manually define which mode you want it to be in, but I've not
experienced this problem. To check if it's working as a modem, just plug it in
and use lsusb
. If you do need to switch, remove all of the relevant modules
(usb-storage
, usb-serial
and possibly option
) before loading usb-serial
back again. There's also a package available called usb-modeswitch
(in
Debian's testing repository) which will do this for you.
On the assumption that you've got mode switching sorted, install the wvdial
package which will make PPP configuration and dialing rather a lot easier.
Whilst there is a Linux version of the Vodafone mobile connect software
available here, it
requires GTK and often I don't want to fire up X just to connect to the internet
(I actually used that software to help me determine the initialisation strings
needed to be sent). Then put the following as your /etc/wvdial.conf
:
[Dialer vodafone]
Modem = /dev/ttyUSB0
Phone = *99***1#
Username = web
Password = web
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","pp.internet"
Stupid Mode = 1
Auto DNS = 0
A quick note about that last line: that stops wvdial
from setting the DNS
servers in /etc/resolv.conf
. I also comment out the usepeerdns
line in
/etc/ppp/peers/wvdial
. Both of these are necessary to stop pppd from
overwriting my resolv.conf
. I've found that DNS lookups are a bit of a
bottleneck on the Vodafone PAYG modem, so I'm switching to my standard
(OpenDNS based) DNS settings to see if things will be
a bit snappier. I haven't done any formal benchmarking on this yet, just going
by gut feeling.
Finally, issue wvdial vodafone
to bring the interface up.