How to Install Huawei E220 USB Modem on Centos 5.4

You want to install Huawei E220 USB Modem on Centos 5.4 and use the modem to access internet? If you use Slackware 12.2 or Fedora 12, click here for Slackware 12.2 or here for Fedora 12 to follow the tutorials.

It is very easy to do this. CentOS 5.4 that using kernel 2.6.18-164 is smart enough to autodetect the device so you do not need huaweiAktBbo-i386.out tool to switch the modem to the correct mode for serial port. In my case, it is detected and attached to ttyUSB0 and ttyUSB1. When you connect the modem to your laptop or PC via USB port, you would see log messages in ‘dmesg’ command something like below:

usb 2-2: new full speed USB device using uhci_hcd and address 2
usb 2-2: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver...
scsi3 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb 2-2: USB disconnect, address 2
usb 2-2: new full speed USB device using uhci_hcd and address 3
usb 2-2: configuration #1 chosen from 1 choice
usb-storage: probe of 2-2:1.0 failed with error -5
usb-storage: probe of 2-2:1.1 failed with error -5
scsi6 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
usbcore: registered new driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
option 2-2:1.0: GSM modem (1-port) converter detected
usb 2-2: GSM modem (1-port) converter now attached to ttyUSB0
option 2-2:1.1: GSM modem (1-port) converter detected
usb 2-2: GSM modem (1-port) converter now attached to ttyUSB1
usbcore: registered new driver option
drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1
  Vendor: HUAWEI    Model: Mass Storage      Rev: 2.31
  Type:   CD-ROM                             ANSI SCSI revision: 02
scsi 6:0:0:0: Attached scsi generic sg1 type 5
usb-storage: device scan complete

As you can see above, Centos 5.4 already attached the modem to ttyUSB0 and ttyUSB1.
[ad#Chitika468x180]
Now build a configuration file for wvdial and stored it in /etc/wvdial.conf file by running wvdialconf command as below:

[root@fuad ~]# wvdialconf /etc/wvdial.conf
Scanning your serial ports for a modem.

Port Scan<*1>: S0   S1   S2   S3
WvModem<*1>: Cannot get information for serial port.
ttyUSB0<*1>: ATQ0 V1 E1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB0<*1>: Modem Identifier: ATI -- Manufacturer: huawei
ttyUSB0<*1>: Speed 4800: AT -- OK
ttyUSB0<*1>: Speed 9600: AT -- OK
ttyUSB0<*1>: Speed 19200: AT -- OK
ttyUSB0<*1>: Speed 38400: AT -- OK
ttyUSB0<*1>: Speed 57600: AT -- OK
ttyUSB0<*1>: Speed 115200: AT -- OK
ttyUSB0<*1>: Speed 230400: AT -- OK
ttyUSB0<*1>: Speed 460800: AT -- OK
ttyUSB0<*1>: Max speed is 460800; that should be safe.
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
WvModem<*1>: Cannot get information for serial port.
ttyUSB1<*1>: ATQ0 V1 E1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB1<*1>: Modem Identifier: ATI -- Manufacturer: huawei
ttyUSB1<*1>: Speed 4800: AT -- OK
ttyUSB1<*1>: Speed 9600: AT -- OK
ttyUSB1<*1>: Speed 19200: AT -- OK
ttyUSB1<*1>: Speed 38400: AT -- OK
ttyUSB1<*1>: Speed 57600: AT -- OK
ttyUSB1<*1>: Speed 115200: AT -- OK
ttyUSB1<*1>: Speed 230400: AT -- OK
ttyUSB1<*1>: Speed 460800: AT -- OK
ttyUSB1<*1>: Max speed is 460800; that should be safe.
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found a modem on /dev/ttyUSB0.
Modem configuration written to /etc/wvdial.conf.
ttyUSB0: Speed 460800; init \"ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0\"
ttyUSB1: Speed 460800; init \"ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0\"

The command above will generate wvdial.conf after scanning the modem. You can check that file and should be like this:

[root@fuad ~]# cat /etc/wvdial.conf
[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem
; Phone = 
; Username = 
; Password =

You have to edit the Phone, Username and Password of the configuration above to meet your account.

For example, it should be like below:

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem
Phone = *99#
Username = fuadnahdi
Password = secret-eh

The next step is running ‘wvdial’ command as root. By default it will read /etc/wvdial.conf as we configured before.

[root@fuad ~]# wvdial
--> WvDial: Internet dialer version 1.54.0
--> Cannot 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
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Waiting for prompt.
--> Don\'t know what to do!  Starting pppd and hoping for the best.
--> Starting pppd at Mon Nov  1 19:51:01 2009
--> pid of pppd: 4206
--> Using interface ppp0
--> local  IP address 114.59.189.52
--> remote IP address 10.64.64.64
--> primary   DNS address 202.155.0.10
--> secondary DNS address 202.155.0.15

If successful you will get an IP address and DNS server assigned to you. For the DNS server, you need to manually write it into /etc/resolv.conf because the wvdial script will not automatically write it for you.