Comment 8 for bug 413989

Revision history for this message
Flemming Bjerke (flem) wrote :

I have made the following two scripts (from pages found on ubuntu.org) that get my Huawei E220 (and probably many others) on the net without problems:

In your home folder you make a file called:

Put the following in /etc/wvdial.conf
---------------------------------------------
[Dialer cell]
# This configuration should work for most cellular modems and
# USB or bluetooth connected mobile phones.

# Most services/devices dial with *99# . A few seem to require *99***1#
Phone = *99#

# These often suffice, but your ISP might require different details. They're
# often dummy details used for all users on the ISP, frequently the ISP's
# name, but some ISP's do require you to use a real username and password.
Username = foo
Password = foo
Stupid Mode = 1
Dial Command = ATDT

# Your modem device. Usually /dev/ttyUSB0 or /dev/ttyACM0
# Bluetooth devices use an rfcomm device (/dev/rfcomm0, etc) that must be set
# up first.
#
#Modem = /dev/rfcomm0
#Modem = /dev/ttyACM0
Modem = /dev/ttyUSB0

# Port speeds that're worth testing:
#Baud 921600
Baud = 460800
#Baud 115200
#Baud 57600

# If your SIM card has a PIN, comment this line, uncomment the next one, and
# change the PIN shown to your PIN. If your modem cannot read the pin-code,
# you may put the card in your cell phone and remove the pin request. Then
# ATZ will do. (Consider carefully if this is a good idea.)
#Init2 = ATZ+CPIN="0000"
Init2 = ATZ

Init3 = ATE0V1&D2&C1S0=0+IFC=2,2
ISDN = 0
Modem Type = Analog Modem

# If you know your ISP's APN, specify it instead of YOUR_ISP_APN below.
# If you don't, you may be able to find out on the 'net, or from tech
# support.
# There's also an APN table at https://wiki.ubuntu.com/NetworkManager/Hardware/3G .
# If you can't find it, you might be able to dial out without setting an APN
# (especially from a mobile phone). Just comment this line and uncomment
# the next one.
#Init5 = AT+CGDCONT=1,"IP"
Init5 = AT+CGDCONT=1,"IP","YOUR_ISP_APN";
-------------------------------------------

Now, as root put the following script in /usr/local/bin

If you name the script
huaw
you must make executable:
sudo chmod u+x /usr/loca/bin/huaw

The script huaw
------------------------------------------
#!/bin/bash
#You must configure the following variables:
#Check with ifconfig
#Wired device
WI='eth0'
#Wireless device (probably wlan0)
WL='eth1'
#Checkout you vendor and product on:
#https://wiki.ubuntu.com/NetworkManager/Hardware/3G
VE='0x12d1'
PR='0x1003'

#Kill old wvdia-connections
killall wvdial

#Then kill any wired or wireless connection so that
#they don't interfere with your route table
ifconfig $WI down
ifconfig $WL down

#Uninstall and re-install the driver in order to ensure
#that the device /dev/ttyUSB0 is active
rmmod --force usbserial
modprobe usbserial vendor=$VE product=$PR

#start the connection with wvdial
#the dialup script must be in ~/.wvdialrc under [cell]
wvdial cell &

#route packets to the gateway-ip that is under P-t-P
#in ifconfig
A=`ifconfig | grep -A 2 ppp0 | grep P-t-P`
A1=`expr index "$A" P`
B=${A:$A1}
A2=`expr index "$B" M`
A2=$(($A2-6))
C=${B:5:$A2}
echo "Gateway: $C"
route add default gw "$C"
----------------------------------------------------------------

Please, read both the scripts carefully and change variables etc.

When you have fixed this, you should be able to come on the net with the following command:
sudo huaw

Sometimes you have to run script two times. You may check if you are on the net with:
host ubuntu.org

I hope network manager will work some day.