Miticojo's Blog

IT or NOT IT this is the question!

Linux / Debian: Connection with Huawei UMTS USB modem

| 0 comments | 0 comments

This article will give you some tips on how to configure your modem Huawei E220 UMTS (and later) to connect to the Internet with national operators.

The following procedure was tested with a distro is Debian Etch 4 i386 on PC than on the virtual machine.

Step 1: Install drivers for USB modem HUAWEI E220 HSDPA 3G UMTS

To find out if your PC detects the device connected simply run the command:

cat / proc / bus / usb / devices

between results and you will notice this:

Vendor = 12d1 ProdID = 1003 Rev = 0.00
Manufacturer = HUAWEI
Product = HUAWEI Technologies Mobile

At this point we download from the site http://www.kanoistika.sk/bobovsky/archiv/umts/ huaweiAktBbo-i386.out file (to compile the source code is available) then:

cd / usr / sbin
wget http://www.kanoistika.sk/bobovsky/archiv/umts/huaweiAktBbo-i386.out

We write a script for initialization and device driver to load / usr / sbin / init-huawei

# / Bin / bash
rmmod usb-storage
rmmod usb-serial
mknod / dev/ttyUSB0 c 188 0
mknod / dev/ttyUSB1 c 188 1
mknod / c 188 2 dev/ttyUSB2
modprobe usbserial vendor = 0x12d1 product = 0 × 1003
sleep 10
sudo / usr/sbin/huaweiAktBbo-i386.out
sleep 3

I attribute the execute permissions and launch the script:

chmod + x / usr / sbin / init-huawei
/ Usr / sbin / init-huawei

At this point you will find three doors / dev/ttyUSB0 / dev/ttyUSB1 / dev/ttyUSB2

Step 2: Installing and configuring the software connection

WvDial PPP and install:

apt-get install ppp wvdial

Now I create the file / etc/chatscripts/huawei-e220.chat

TIMEOUT 3
ABORT BUSY
ABORT 'NO CARRIER'
ABORT VOICE
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT DELAYED
"" ATZ
OK ATQ0V1E1S0 = 0 & C1 & D2
OK ATDT * 99 #
CONNECT ""

I create the configuration file for that PPP / etc/ppp/peers/huawei-e220

/ Dev/ttyUSB0
7200000
noipdefault
defaultroute
persist
noauth
nodetach
usepeerdns
connect "/ usr / sbin / chat-vf / etc/chatscripts/huawei-e220.chat"

I create the configuration file for WvDial or / etc / wvdial.conf (configuration for Vodafone)

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0 = 0 & C1 & D2 + FCLASS = 0
Init3 = AT + CGDCONT = 1, "IP", "web.omnitel.it"
Modem = / dev/ttyUSB0
Phone = * 99 *** 1 #
Idle Seconds = 10000
Auto DNS = 208.67.222.222
Password = vodafone
Modem Type = Analog Modem
Stupid Mode = 1
Compuserve = 0
Baud = 7200000
New PPPD = yes
Dial Command = ATDT
Ask Password = 0
ISDN = 0
Username = vodafone

Step 3: I connect to the internet ...

At this point I can run the command to start the connection and put it in the background:

wvdial &

and I will get the following result:

-> WvDial: Internet dialer version 1:56
-> Can not get information for serial port.
-> Initializing modem.
-> Sending: ATZ
ATZ
OK
-> Sending: ATQ0 V1 E1 S0 = 0 & C1 & D2 + FCLASS = 0
ATQ0 V1 E1 S0 = 0 & C1 & D2 + FCLASS = 0
OK
-> Sending: AT + CGDCONT = 1, "IP", "web.omnitel.it"
AT + CGDCONT = 1, "IP", "web.omnitel.it"
OK
-> Modem initialized.
-> Idle Seconds = 10000, disabling automatic reconnect.
-> Sending: ATDT * 99 *** 1 #
-> Waiting for carrier.
ATDT * 99 *** 1 #
CONNECT
-> Carrier detected. Starting PPP immediately.
-> Starting pppd at Sun Mar -------
-> Pid of pppd: 13337
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Using interface ppp0
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Local IP address 83.225.112.xxx
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Remote IP address 10.64.64.64 *
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Primary DNS address 83.224.66.13 4
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]
-> Secondary DNS address 83.224.65.134
-> Pppd: H [08] ô · H [04] [06] [08] Ø [06] [08]

So there is a new interface ppp0 connection with the data that I have highlighted (IP, Gateway and DNS) and from this monento're on the internet .... good navigation ...

To close the connection you can use the command offhand

killall wvdial

Breaking considerations and troubleshooting

If not using Vodafone you point below the appointing authority to configure the AT string in / etc / wvdial.conf

for Wind: AT + CGDCONT = 1, "IP", "internet.wind"

TIM: AT + CGDCONT = 1, "IP", "ibox.tim.it"

for 3: AT + CGDCONT = 1, "IP", "tre.it"
(Data subscriptions for the apn is datacard.tre.it)

for more reference configurations to: http://www.ikaro.net/articoli/cnt/configurazioni_internet_cellulari-00315.html

If you have network problems with the internet, have a controlled routes present in your machine with the command

route-n

and verify that the default route of your system matches the gateway assigned to UMTS (* then the remote IP addres ... in my case 10.64.64.64) or check that the DNS assigned automatically by the provider are valid (/ etc / resolv.conf . conf).

Also, if your SIM card requires access through pin I recommend this script in Python (/ usr / sbin / huawei-pin):

#! / Usr / bin / python
import serial
serial.Serial ser = ('/ dev/ttyUSB0', 115200, timeout = 1)
ser.write ('AT + CPIN = PIN \ r')
ser.readline line = ()
ser.close ()
print line

replace the text with your PIN number and pin given the power to run the script:

chmod + x / usr / sbin / huawei-pin

then insert the board of appeal of the script file in the modem initialization / usr / sbin / init so huawei-pin is inserted immediately after the activation of the modem in the system.

Once the connection is ppp0 interface and its connection can for example be handled with shorewall for failover connection in case of down your ADSL or to balance load or to the simple NAT for your LAN connection sharing.
Followed by a short article that will show you how to send SMS with your modem just installed ...

I hope it was helpful and as always if you want to do, questions, clarifications or improvements please write your comments.

Sources: Article is ripresto and contextualised by

Further Reading:

Vodafone Mobile Connect Card Drivers
https://forge.betavine.net/frs/?group_id=12&release_id=11

Debian Reference - Network configuration - 10.2.4 Configuring a PPP interface
http://www.debian.org/doc/manuals/reference/ch-gateway.en.html

Related Articles

  1. Linux / Debian: Getting IP addresses in shell
  2. Linux / Debian: login email notification in Python
To comment, click below to login.

Leave a Reply

Required fields are marked *.

*

Immagine CAPTCHA
Change image

*