歡迎您光臨本站 註冊首頁

Linux 天翼3G上網

←手機掃碼閱讀     火星人 @ 2014-03-12 , reply:0
  
快畢業,校園網到期了,不想再用銳捷上網。在圖書館用wifi無線,在宿舍打算用3G。

於是買了個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) (dannf@debian.org) (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
修改成
$ cat /etc/wvdial.conf
[Dialer 3G]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = #777
ISDN = 0
Username = ctnet@mycdma.cn
Init1 = ATZ
Password = vnet.mobi
Modem = /dev/ttyUSB_utps_modem
Baud = 115200

撥號運行命令
$ 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
OK
--> 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
--> pppd: ?s HPs
--> pppd: ?s HPs
--> pppd: ?s HPs
--> pppd: ?s HPs
--> local  IP address 113.113.169.226
--> pppd: ?s HPs
--> remote IP address 10.10.88.48
--> pppd: ?s HPs
--> primary   DNS address 202.96.128.86
--> pppd: ?s HPs
--> secondary DNS address 220.192.32.103
--> pppd: ?s HPs

撥號成功 : )

3. 附贈-我的wvdial.conf
$ cat /etc/wvdial.conf

[Dialer usb]
Init1 = ATZ
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
ISDN = 0
Username = 172
FlowControl = NOFLOW
Modem = /dev/ttyACM0

[Dialer bt]
Init1 = ATZ
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 = BlueTooth Modem
Stupid Mode = 1
Baud = 460800
Auto DNS = 1
Dial Command = ATD
Ask Password = 0
ISDN = 0
Username = 172
FlowControl = NOFLOW
Modem = /dev/rfcomm0

[Dialer 3G]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = #777
ISDN = 0
Username = ctnet@mycdma.cn
Init1 = ATZ
Password = vnet.mobi
Modem = /dev/ttyUSB_utps_modem
Baud = 115200





3g


[火星人 ] Linux 天翼3G上網已經有584次圍觀

http://coctec.com/docs/linux/show-post-65913.html