linux -- 华为ET128 &中兴ZTE MU351移动TD-SCDMA G3上网卡 .
上网卡型号:HUAWEI ET128 ZTE MU351
1、首先下载安装usb_modeswitch:
#wget http://www.draisberghof.de/usb_modesw ... _modeswitch-1.0.2.tar.bz2
解压,编译安装:
#tar xjvf usb_modeswitch-1.0.2.tar.bz2
#cd usb_modeswitch-1.0.2
#make install
然后编辑usb_modeswitch.conf配置文件:
#vi /etc/usb_modeswitch.conf
该配置文件内有世面上绝大多数的无线上网卡配置信息,但没有华为ET128硬件的相关信息(可能比较新吧),需要手工添加如下内容进去
######################################
# Huawei ET128
#
# Contributor: Dale Lane
DefaultVendor= 0x12d1;
DefaultProduct= 0x1da1
# choose one of these:
DetachStorageOnly=0
HuaweiMode=1
######################################
中兴MU351上网卡修改/etc/usb_modeswitch.conf,添加如下内容:
######################################
# ZTE MU351
#
# Contributor: Dale Lane
DefaultVendor= 0x19d2;
DefaultProduct= 0x0003
# choose one of these:
DetachStorageOnly=0
MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
######################################
其中注意红色部分,是厂商信息和硬件信息,可以通过lsusb命令查看获取:
#lsusb
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 0b05:b700 ASUSTek Computer, Inc.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 04fc:0003 Sunplus Technology Co., Ltd CM1092 Optical Scroller Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 012: ID 12d1:1da1 Huawei Technologies Co., Ltd.
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
中兴MU351查看lsusb得出的信息为:
# lsusb
Bus 004 Device 002: ID 0b05:b700 ASUSTek Computer, Inc.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 003: ID 04f2:b071 Chicony Electronics Co., Ltd
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 012: ID 19d2:0003
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
2、配置完成后,执行usb_modeswitch -W命令创建tty设备
# usb_modeswitch -W
再查看dmesg信息,如果有生成新的ttyACMx设备即表示成功
#dmesg
cdc_acm 1-2:3.1: ttyACM0: USB ACM device
cdc_acm 1-2:3.3: ttyACM1: USB ACM device
cdc_acm 1-2:3.5: ttyACM2: USB ACM device
中兴MU351的dmese信息中应该生成如下设备:
#dmesg |grep tty
option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
usb 2-1: GSM modem (1-port) converter now attached to ttyUSB3
3、安装wvdail拨号工具,源里有(据说可以在NetworkManager下使用,但我没配置成功,望达人指教)
#yum install wvdial
执行wvdialconf扫描硬件并生成配置文件:
#wvdialconf
编辑/etc/wvdial.conf配置文件加入如下拨号配置信息:
;########################
Phone = *99***1#
Password = any
Username = any
Stupid Mode = 1
中兴MU351执行wvdialconf会报错,无法生成配置文件,不用理会,直接编辑/etc/wvdial.conf,添加如下内容:
[Dialer Defaults]
Modem = /dev/ttyUSB2
Init1 = ATZ
Init3 = ATE0V1
Init5 = ATS0=0
Init6 = AT+CGDCONT=1,"IP","cmcc"
Init7 = AT+CFUN=1
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
ISDN = 0
Phone = *99***1#
Password = any
Username = any
Stupid Mode = 1
4、拨号:
#wvdial
--> Ignoring malformed input line: ";########################"
--> 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*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT 2800000
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Mon Jul 27 16:31:44 2009
--> Pid of pppd: 3667
--> Using interface ppp0
--> pppd: ??[06][08][10]?[06][08]
--> pppd: ??[06][08][10]?[06][08]
--> pppd: ??[06][08][10]?[06][08]
--> pppd: ??[06][08][10]?[06][08]
--> pppd: ??[06][08][10]?[06][08]
--> local  IP address 10.140.68.38
--> pppd: ??[06][08][10]?[06][08]
--> remote IP address 192.200.1.21
--> pppd: ??[06][08][10]?[06][08]
--> primary   DNS address 221.130.33.60
--> pppd: ??[06][08][10]?[06][08]
--> secondary DNS address 221.130.33.52
--> pppd: ??[06][08][10]?[06][08]
OK,冲浪去吧,关闭只需crtl + c
想方便可以写个脚本放到桌面:
#!/bin/sh
/usr/sbin/usb_modeswitch -W
sleep 5
echo "nameserver 202.106.0.20" >/etc/resolv.conf
konsole -e /usr/bin/wvdial
每次插上上网卡,等待5秒,然后双击该脚本,断线时按ctrl + c即可