10 June 2007

Three Ireland USB Modem HOWTO

Three Ireland has recently unveiled a new HSDPA mobile broadband product. It includes 10 gigabytes data transfer (note: received plus transmitted, not just received!) for €20 per month. The modem is a Huawei E220, a nice little white USB box that, unfortunately, has no external antenna attachment.

The quality is, in my experience, not as good as "conventional" broadband - for example, a SIP VoIP service produced a latency of several seconds and some disruptions. But it may be the fact that coverage is not perfect here... Anyway, for some areas it can be the only real broadband option apart from satellite - like where I live. And it's way better than dialup, and way cheaper and probably better than satellite! Not to mention it being mobile.

The product will work within Three's 3G coverage only; Three has a map but it's not really detailed enough. So the best option is probably to rely on their 14 day return policy. Grab it and try it.

Preferrably, try it with the native Windows driver first - it shows the signal strength, and under Linux this is not yet possible. Although you can possibly see whether you're in coverage even on the modem itself - when trying to connect (and sometimes even before that), it will flash blue if you are in 3G coverage, but green if you are not. (But I don't know what it will do if it is in Vodafone's 3G coverage but not in Three's!) . By the way, if you are in coverage, and do see signal strength, but keep getting "Connection failed" messages, see the note at the bottom.

OK, let's say it works in your area, and you want to use it under Linux. The instructions here are for Debian; I think they will apply unchanged to Debian derivatives including Ubuntu; in other distros file locaton and security may vary. I am only using pppd, which should be present on all systems; wvdial is not used.

First, we will need to set up DNS addresses. Unfortunately, the DNS servers provided in the PPP protocol don't work right; I don't know how Three provides correct DNS later but Linux does not catch it - so we'll just make DNS static. For this, as root, edit /etc/resolv.conf; it should contain one or more "nameserver" entries with DNS addresses. You may have a favourite DNS of your own; or to use Three's ones, put the following in /etc/resolv.conf :

nameserver 172.31.140.69
nameserver 172.30.140.69
Next we create the configuration files for pppd.

In /etc/ppp/peers/provider :

user "user"

connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T *99#"

# Serial device to which the modem is connected.
/dev/ttyUSB0

# Speed of the serial line.
460800

# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
#usepeerdns
# Use this connection as the default route.
defaultroute

# Makes pppd "dial again" when the connection is lost.
persist

# Do not ask the remote to authenticate.
noauth

# pppd will detach from controlling terminal when connection is up
updetach

# no compression - ppp is used only until the modem
novj
novjccomp
nopcomp
nodeflate

# put in a default gateway even if one was present before
replacedefaultroute

# if connection has failed, redial in this number of seconds
# don't use too low - 3 seems to drive modem crazy
holdoff 5

In /etc/chatscripts/pap :

ABORT           BUSY
ABORT           VOICE
ABORT           "NO CARRIER"
ABORT           "NO DIALTONE"
ABORT           "NO DIAL TONE"
""              ATZ
OK ATE0V1&D2&C1S0=0+IFC=2,2
OK AT+CGDCONT=1,"IP","3ireland.ie"
OK ATDT*99#
CONNECT         ""

Now our pppd is ready.

To connect, we will need to attach the modem, and execute, as root:

modprobe usbserial vendor=0x12d1 product=0x1003
Note that we will need to do it on every new boot as well - after the modem is attached. (Of course we can keep it attached permanently - but still execute this command every boot). Also, the modem possibly does not work if unplugged and then replugged within the same session (i.e. no reboot between). There may be a way to fix this all but I have not yet discovered it; advice would be most welcome!

After this, connecting is easy. Either as root, or as a user that is in the "dip", execute this command: pon And watch the terminal. Once it reports your IP address, you are online! If it reports "Timeout" something instead, either you are out of coverage (check using the Windows driver) or you have hit APN problems - see note at the bottom.

To get offline, either just shut down your system or type:

poff

NOTE: Three APN issues

Apparently Three has APN (Access Point Name) issues. At peak usage times, you try connecting with good coverage and it just fails, In Windows, you see "Connection failed"; in Linux, it's "Timeout" something.

The way around this is just to try and try again.Sooner or layer you get in. But don't try *very* often; when I tried every 3 seconds the modem stopped blikning its blue "coverage available" light.

In Windows, all you can do is click that button over and over again. In Linux, pppd just redials automatically; but it's highly advisable to always run pppd ("pon") in a terminal window, so you can see what's going on in teh redialling process.

I hope somebody will persuade Three to fix this. Tech support was not helpful for me - they just blame bad coverage in my area, but probably they are wrong. Related:
Connection Scripts
Setting up a modem in Linux
Setting up a ppp internet connection


About the author, Mikhail Ramendik.