Skip to content

Linux Daily

Daily usage of linux, raw style

Huaweii E220I’m from portugal and a couple of years ago this internet over 3G networks came to the market. I am *unlucky* enough to own of those slow things, and I have one of those white huaweii modems, like in the picture. Setting this up to work in linux was of the biggest battles I fought. And from what I read in Linux Format (UK magazine), it’s a common problem because it’s hell to get it to work properly. I finally got it to work, and learned a few helpfull things:

1– The modem is correctly recognized if it’s already plugged in when you turn on the computer, if you plug it in afterwards it won’t work. This happens because the modem is treated both as a mass storage device and a modem and the kernel flips. (there is a work around, I’ll talk about it in a minute)

2– The program used to connect to the internet is wvdial (comes with ubuntu) and you have to edit it’s configuration file (/etc/wvdial.conf) to make the connection work. There is a program to configure it automatically (wvconf I believe) but it didn’t work for me. Instead of wvdial you can use gnome-ppp, which is basically a GUI for wvdial but honestly, the program sucks.

3– Sometimes the dns address isn’t correctly extracted from the modem. It’s a possible signal this is happening if the led on the modem stops blinking, but you have no internet access. Defining the correct dns address in wvdial.conf didn’t work for me, probably due to a bug in wvdial.Handwriting the correct one in /etc/resolv.conf solves the issue, something like

sudo gedit /etc/resolv.conf

One of the most difficult parts is trying to figure out what configuration you have to put in wvdial.conf. There are a lot of different fields such as modem type, phone number, username, password etc. Asides from the hardware parts, the configuration is specific to each mobile carrier (I think that’s the word). Some ask for the password (which is the pin of sim card) others don’t, the username may vary. Who knows. Chances are some linux geek figured it out for you, but you’ll have to google it.

I’m attaching the configuration file for my mobile operator Optimus to this post and write some instructions in portuguese because it kind of makes sense. The attachment is wvdialconf.odt because wordpress limits the filetypes you can upload, so just rename the file to wvdial.conf and you’re good to go. Stupid, I know. Not my fault…

One last note about plugging the modem after booting the pc. I found a shell script that correctly mounts the modem, but I don’t have it right now and I think it was broken in linux version 2.6.24-16. The current version is 19, I’ll try and find it, test it and then post it here for future reference.

Agora em portugues, vou fazer copypaste dum email que mandei para um amigo meu. Deu à primeira com ele, e comigo tambem da por isso deve funcionar. Outra vez, isto e para modem huaweii como os da foto e para o serviço Kanguru da Optimus.

“Se tas a correr o ubuntu 8.04, ta td fixe pq o WvDial ja vem de origem e nao tens k instalar nada. Se tas com o 7… achas k tas fdd, tem depencias que nunca mais acabam.

substitui o teu /etc/wvdial.conf por

[Dialer 640k]
Init6 = AT+CGEQMIN=1,4,64,640,64,640
Init7 = AT+CGEQREQ=1,4,64,640,64,640

[Dialer kanguru]
Init2 = ATZ

Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem = /dev/ttyUSB0
Modem Type = USB Modem
Baud = 460800

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = 1
Modem Type = Analog Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/ttySL0
Username = myconnection
Dial Command = ATDT
Password = 8159
Baud = 460800

[Dialer 3gonly]
Init4 = AT+COPS=0,0,”Vodacom-SA”,2

Agora na secçao dialer defaults, a password é o pin do cartao. Eu tb nao sabia o meu, liguei pa la e os gajos disseram-me. É a unica coisa que tens que mudar. Para começar é so

wvdial kanguru

Nota1: Se keres k o modem monte direito, liga o pc ja com o modem ligado, nao o ligues so depois do ubuntu ter começado pq senao da merda. Qualquer merda com o modulo do kernel que ninguem sabe explicar.

Nota2:As ultimas linhas que o wvdial apresenta na consola mostram o ip e o dns. No meu caso, o dns é constante mal configurado. E assim, o modem fica com a luzinha ligada mas nao ha internet pa ninguem. Soluçao e veres quais os servidores dns correctos numa ligaçao do kanguru em windows, e depois metes isso em /etc/resolv.conf”

And that’s that. Follow up posts about the modem mounting script and an application I’m programming will ensue in due time. I’m currently in exams and I have zero spare time. I wrote this because I took an afternoon off after an electromagnetic waves exam.

And btw, just wanna say hi to the guy who wrote a comment in my first post. thanx dude : -)

attached: wvdialconf.odt


Tags: , , , , , , , , , , ,

%d bloggers like this: