3G card on Linux

From CLUG Wiki

Jump to: navigation, search

This page details how to get a Huawei E620 3G data card working under Ubuntu Linux (Edgy Eft) with Vodacom as the network operator. It is based on this thread: http://mybroadband.co.za/vb/showthread.php?t=21726 and Tazz_Tux's posts in particular.


Contents

Logging

Ubuntu does not log all messages by default. We want some extra detail, for debugging purposes, so we're going to temporarily tell Ubuntu to log all messages it receives to a file. Do this by editing the file /etc/syslog.conf and adding the following line:

 *.*                             /var/log/all.log

This tells syslog to send messages with all tags (the first '*') and at all levels (the second '*') to the file /var/log/all.log.

You probably don't want this file hanging around generally - it could get quite large. Remember to remove this line when you have everything working.

After editing /etc/syslog.conf, restart syslog:

 /etc/init.d/sysklogd restart

Devices

Check for device entries for your data card:

ls -l /dev/ |grep S

We are interested in this entry:

crw-rw---- 1 root dialout 188,   0 2006-12-05 19:10 ttyUSB0


Check the type of card that you have with:

lsusb

We are looking for an entry the same as or similar to:

Bus 006 Device 002: ID 12d1:1001


Loading Modules

Remove and re-add the USB serial module (driver) specifying the datacard:

rmmod usbserial && modprobe usbserial vendor=0x12d1 product=0x1001


Monitoring

Monitor what is happening by:

tail -f /var/log/all.log

The output of the tail -f command should show the following when the card is inserted:

Dec  5 20:54:12 localhost kernel: [17185962.576000] pccard: CardBus card inserted into slot 1
Dec  5 20:54:12 localhost kernel: [17185962.576000] PCI: Enabling device 0000:04:00.0 (0000 -> 0002)
Dec  5 20:54:12 localhost kernel: [17185962.576000] ACPI: PCI Interrupt 0000:04:00.0[A] -> GSI 19 (level, low) -> IRQ 185
Dec  5 20:54:12 localhost kernel: [17185962.576000] PCI: Setting latency timer of device 0000:04:00.0 to 64
Dec  5 20:54:12 localhost kernel: [17185962.576000] ohci_hcd 0000:04:00.0: OHCI Host Controller
Dec  5 20:54:12 localhost kernel: [17185962.576000] ohci_hcd 0000:04:00.0: new USB bus registered, assigned bus number 6
Dec  5 20:54:12 localhost kernel: [17185962.576000] ohci_hcd 0000:04:00.0: irq 185, io mem 0x26000000
Dec  5 20:54:12 localhost kernel: [17185962.660000] usb usb6: configuration #1 chosen from 1 choice
Dec  5 20:54:12 localhost kernel: [17185962.660000] hub 6-0:1.0: USB hub found
Dec  5 20:54:12 localhost kernel: [17185962.660000] hub 6-0:1.0: 1 port detected
Dec  5 20:54:12 localhost kernel: [17185962.764000] PCI: Enabling device 0000:04:00.1 (0000 -> 0002)
Dec  5 20:54:12 localhost kernel: [17185962.764000] ACPI: PCI Interrupt 0000:04:00.1[B] -> GSI 19 (level, low) -> IRQ 185
Dec  5 20:54:12 localhost kernel: [17185962.764000] PCI: Setting latency timer of device 0000:04:00.1 to 64
Dec  5 20:54:12 localhost kernel: [17185962.764000] ohci_hcd 0000:04:00.1: OHCI Host Controller
Dec  5 20:54:12 localhost kernel: [17185962.764000] ohci_hcd 0000:04:00.1: new USB bus registered, assigned bus number 7
Dec  5 20:54:12 localhost kernel: [17185962.764000] ohci_hcd 0000:04:00.1: irq 185, io mem 0x26001000
Dec  5 20:54:12 localhost kernel: [17185962.888000] usb usb7: configuration #1 chosen from 1 choice
Dec  5 20:54:12 localhost kernel: [17185962.888000] hub 7-0:1.0: USB hub found
Dec  5 20:54:12 localhost kernel: [17185962.888000] hub 7-0:1.0: 1 port detected
Dec  5 20:54:15 localhost kernel: [17185965.308000] ohci_hcd 0000:04:00.0: wakeup
Dec  5 20:54:15 localhost kernel: [17185965.692000] usb 6-1: new full speed USB device using ohci_hcd and address 2
Dec  5 20:54:15 localhost kernel: [17185965.904000] usb 6-1: configuration #1 chosen from 1 choice
Dec  5 20:54:15 localhost kernel: [17185965.908000] option 6-1:1.0: Option 3G data card converter detected
Dec  5 20:54:15 localhost kernel: [17185965.908000] usb 6-1: Option 3G data card converter now attached to ttyUSB0
Dec  5 20:54:15 localhost kernel: [17185965.912000] option 6-1:1.1: Option 3G data card converter detected
Dec  5 20:54:15 localhost kernel: [17185965.912000] usb 6-1: Option 3G data card converter now attached to ttyUSB1
Dec  5 20:54:16 localhost kernel: [17185965.916000] option 6-1:1.2: Option 3G data card converter detected
Dec  5 20:54:16 localhost kernel: [17185965.916000] usb 6-1: Option 3G data card converter now attached to ttyUSB2


Routing

Check default routes:

route -n
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
99.88.77.66     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0


If you need to remove a default gateway to a remote IP other than the one shown when you start a PPP connection you can do so as follows:

route del gw 99.88.77.66

Where 99.88.77.66 is the IP of the gateway.


PIN

I chose to remove the pin from the SIM card by inserting it into a cell phone and disabling the PIN request option.


Configuration

vi /etc/wvdial.conf

Add the following lines:

# wvdial for Vodacom Data. Created by Tazz_tux
# Version 1.0
#
# Change Log:
#
# Added support for HSDPA.
# Added Headers and version control.

[Dialer Defaults]

Phone = *99***1#
Username = yourusername
Password = yourpassword
Stupid Mode = 1
Dial Command = ATDT

[Dialer pin]

Init1 = AT+CPIN=1234
 

[Dialer hsdpa]

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


[Dialer 2gonly]

Init4 = AT+COPS=0,0,"Vodacom-SA",0

[Dialer 3gonly]

Init4 = AT+COPS=0,0,"Vodacom-SA",2


[Dialer internet]

Init5 = AT+CGDCONT=1,"IP","internet";

[Dialer internetvpn]

Init5 = AT+CGDCONT=1,"IP","internetvpn";

[Dialer myapn]

Init5 = AT+CGDCONT=1,"IP","bussiness.corp123"

[Dialer 384k]

Init6 = AT+CGEQMIN=1,4,64,384,64,384
Init7 = AT+CGEQREQ=1,4,64,384,64,384

[Dialer 144k]

Init6 = AT+CGEQMIN=1,4,64,144,64,144
Init7 = AT+CGEQREQ=1,4,64,144,64,144

[Dialer 64k]

Init6 = AT+CGEQMIN=1,4,64,64,64,64
Init7 = AT+CGEQREQ=1,4,64,64,64,64


Connecting

Start a PPP connection:

wvdial hsdpa myapn
--> WvDial: Internet dialer version 1.56
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> 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","business.corp123"
AT+CGDCONT=1,"IP","business.corp123"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Tue Dec  5 20:57:17 2006
--> Warning: Could not modify /etc/ppp/pap-secrets: Permission denied
--> --> PAP (Password Authentication Protocol) may be flaky.
--> Warning: Could not modify /etc/ppp/chap-secrets: Permission denied
--> --> CHAP (Challenge Handshake) may be flaky.
--> Pid of pppd: 8790
--> Using interface ppp0
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> local  IP address 10.111.32.29
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> remote IP address 10.64.64.64
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> primary   DNS address 10.111.7.51
--> pppd: ȉ
--> [06][08]�
--> [06][08]
--> secondary DNS address 10.111.67.202
--> pppd: ȉ
--> [06][08]�
--> [06][08]