天天看點

Linux 天翼3G上網

華為EC122

硬體資訊如下:

$ lsusb | grep -i Huawei

Bus 003 Device 006: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem

$

這個3G網卡支援中國電信天翼3G标準CDMA2000 ,下載下傳核心網速剛開始為40K/S,然後彪到了200K+/S (不是在做廣告……)

筆者使用軟體平台為Debian5.02,系統具體參數為

$ cat /proc/version 

Linux version 2.6.26-2-686 (Debian 2.6.26-19) ([email protected]) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Wed Aug 19 06:06:52 UTC 2009

1. 安裝驅動

插入3G網卡到USB接口後,GNU/Linux識别該硬體,自動将其挂載到 /media/ChinaTelecom 目錄下

$ pwd

/media/ChinaTelecom

$ ls -F

AutoRun.exe*  autorun.inf*  autorun.sh*     Linux/  SysConfig.dat*

autorun.ico*  autorun.ini*  install_linux*  setup/

$ ./install_linux 

這樣,驅動就安裝好了……快吧

2. 配置撥号上網

筆者喜歡用 wvdial 同時管理 “3G、連手機藍牙、連手機USB” 3種撥号方式 ,是以下面介紹用 wvdial 3G撥号及其配置過程

先介紹配置過程:

插入3G網卡到USB接口後,待其識别該硬體,運作

$ sudo wvdialconf

[sudo] password for c-aries: 

Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

... (省略)

Found a modem on /dev/ttyUSB_utps_modem.

Modem configuration written to /etc/wvdial.conf.

ttyUSB_utps_modem<Info>: Speed 115200; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

ttyUSB_utps_pcui<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

這裡預設配置已寫入檔案 /etc/wvdial.conf 如下

$ cat /etc/wvdial.conf

[Dialer Defaults]

Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

Modem Type = Analog Modem

; Phone = <Target Phone Number>

ISDN = 0

; Username = <Your Login Name>

Init1 = ATZ

; Password = <Your Password>

Modem = /dev/ttyUSB_utps_modem

Baud = 115200

修改成

[Dialer 3G]

Phone = #777

Username = [email protected]

Password = vnet.mobi

撥号運作指令

$ sudo wvdial 3g

--> WvDial: Internet dialer version 1.60

--> 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

--> Modem initialized.

--> Sending: ATDT#777

--> Waiting for carrier.

ATDT#777

CONNECT

--> Carrier detected.  Waiting for prompt.

~[7f]}#@!}!}!} }5}"}&} } } } }#}%B#}%}%}&&qe8@F~

--> PPP negotiation detected.

--> Starting pppd at Sun Mar  7 09:44:49 2010

--> Pid of pppd: 26853

--> Using interface ppp0

--> pppd: ≒s HPs 

--> local  IP address 113.113.169.226

--> remote IP address 10.10.88.48

--> primary   DNS address 202.96.128.86

--> secondary DNS address 220.192.32.103

撥号成功 : )

3. 附贈-我的wvdial.conf

[Dialer usb]

Init2 = AT&FE0V1&C1S0=0

Init3 = AT+cgdcont=1,"IP","CMNET","",0,0

Password = 172

New PPPD = yes

Phone = *99***2#

Idle Seconds = 3000

Modem Type = USB Modem

Stupid Mode = 1

Baud = 460800

Auto DNS = 1

Dial Command = ATD

Ask Password = 0

Username = 172

FlowControl = NOFLOW

Modem = /dev/ttyACM0

[Dialer bt]

Modem Type = BlueTooth Modem

Modem = /dev/rfcomm0

繼續閱讀