Linux 天翼3G上网

来源:Linuxeden 作者:c-aries
  
快毕业,校园网到期了,不想再用锐捷上网。在图书馆用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

Linux 天翼3G上网



时间:2010-03-07 10:09 来源:Linuxeden 作者:c-aries 原文链接

好文,顶一下
(33)
100%
文章真差,踩一下
(0)
0%
------分隔线----------------------------


把开源带在你的身边-精美linux小纪念品
无觅相关文章插件,快速提升流量