Haiwei ET128 Linux

Haiwei ET128 Linux
2009年09月01日 星期二 18:09

everest0.6 安装 HuaWei ET128 3G上网卡

前天去移动办了个随e行G3上网卡,回来一看,只有windows驱动和软件,但我平时多数时间在linux下,用google扒啦了一下,还真有配置方法~,现简化一下,共享之~~

上网卡型号:HUAWEI ET128

系统版本:Qomo 0.6 GCC44 (2.6.29.4-40)

1、首先下载安装usb_modeswitch:

#wget http://www.draisberghof.de/usb_modeswitch/usb_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
######################################


其中注意红色部分,是厂商信息和硬件信息,可以通过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


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


3、安装wvdail拨号工具,源里有(据说可以在NetworkManager下使用,但我没配置成功,望达人指教)

#yum install wvdial

执行wvdialconf扫描硬件并生成配置文件:

#wvdialconf

编辑/etc/wvdial.conf配置文件加入如下拨号配置信息:

;########################
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.con
konsole -e /usr/bin/wvdial
每次插上U盘,然后双击该脚本,断线时按ctrl + c即可

Ubuntu 9.04 安装 HuaWei ET128 3G上网卡

1. 把HuaWei 3G上网卡insert到电脑的USB port.

#dmesg | grep HUAWEI
[ 4411.960220] scsi 10:0:0:0: CD-ROM HUAWEI Mobile CMCC CD 1.25 PQ: 0 ANSI: 0

# lsusb | grep Huawei
Bus 005 Device 007: ID 12d1:1d09 Huawei Technologies Co., Ltd.
这里需要记下ID 后面的.

2.
下载安装usb_modeswitch .
下载地址:http://www.draisberghof.de/usb_modeswitch
安装请看软件的README文件.
拷贝编译完的usb_modeswitch 到/sbin下

#usb_modeswitch -h 查看使用方法

#usb_modeswitch -W 最好执行一下,查看一下设置 print all settings before running

3.需要修改 /etc/wvdial.conf 配置文件.

Please see my config file:

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Baud = 460800
;Baud = 9216000
New PPPD = yes
Modem = /dev/ttyACM2 #这里我是安装了gnome-ppp自动识别出来的
;Modem = /dev/ttyUSB0
ISDN = 0
; Phone = <Target Phone Number>
; Password = <Your Password>
; Username = <Your Login Name>
Phone = *99***1#
Password = any
Username = any
Stupid Mode = 1

4.拔号

$sudo wvdial
可能需要等一会,你会看到
heqiang@heqiang-laptop:~$ sudo wvdial
--> 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 236800
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Jun 11 14:17:31 2009
--> Pid of pppd: 19674
--> Using interface ppp0
--> pppd: �P)J[08]@)J[08]
--> pppd: �P)J[08]@)J[08]
--> pppd: �P)J[08]@)J[08]
--> pppd: �P)J[08]@)J[08]
--> pppd: �P)J[08]@)J[08]
--> pppd: �P)J[08]@)J[08]
--> pppd: �P)J[08]@)J[08]
--> local IP address 10.68.212.84
--> pppd: �P)J[08]@)J[08]
--> remote IP address 192.200.1.21
--> pppd: �P)J[08]@)J[08]
--> primary DNS address 221.130.33.52
--> pppd: �P)J[08]@)J[08]
--> secondary DNS address 221.130.33.60
--> pppd: �P)J[08]@)J[08]


说明连接成功了!

$sudo ifconfig ppp0

ppp0 Link encap:点对点协议
inet 地址:10.68.212.84 点对点:192.200.1.21 掩码:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 跃点数:1
接收数据包:18798 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:14731 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:3
接收字节:23233292 (23.2 MB) 发送字节:1357737 (1.3 MB)


5.
这里写的比较单,相信你能成功.

不行的话,下面的希望有用:

一开始插上3G卡的时候,lsusb显示为:

ubuntu@Ubuntu:~$ lsusb | grep Huawei
Bus 002 Device 002: ID 12d1:1da1 Huawei Technologies Co., Ltd.

这时候,修改/etc/usb_modeswitch.conf:

DefaultVendor= 0x12d1
DefaultProduct= 0x1da1

TargetVendor= 0x12d1
TargetProduct= 0x1da1

HuaweiMode=1

执行sudo usb_modeswitch -W 令修改生效。这时候

ubuntu@Ubuntu:~$ lsusb | grep Huawei
Bus 002 Device 002: ID 12d1:1d09 Huawei Technologies Co., Ltd.

会发现1da1变成了1d09. 然后再修改/etc/usb_modeswitch.conf


DefaultVendor= 0x12d1
DefaultProduct= 0x1d09

TargetVendor= 0x12d1
TargetProduct= 0x1d09

;HuaweiMode=1

再执行sudo usb_modeswitch -W令修改生效。

检查/dev/下面, 会出来ttyACM0, ttyACM1, 和ttyACM2.

然后再执行sudo wvdialconf自动生成配置文件

ubuntu@Ubuntu:~$ sudo wvdialconf
Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

Modem Port Scan<*1>: S0 S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyACM0<*1>: ATQ0 V1 E1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 Z -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyACM0<*1>: Modem Identifier: ATI -- Manufacturer: HuaWei
ttyACM0<*1>: Speed 4800: AT -- OK
ttyACM0<*1>: Speed 9600: AT -- OK
ttyACM0<*1>: Speed 19200: AT -- OK
ttyACM0<*1>: Speed 38400: AT -- OK
ttyACM0<*1>: Speed 57600: AT -- OK
ttyACM0<*1>: Speed 115200: AT -- OK
ttyACM0<*1>: Speed 230400: AT -- OK
ttyACM0<*1>: Speed 460800: AT -- OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
WvModem<*1>: Cannot get information for serial port.
ttyACM1<*1>: ATQ0 V1 E1 -- OK
ttyACM1<*1>: ATQ0 V1 E1 Z -- OK
ttyACM1<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyACM1<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyACM1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyACM1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyACM1<*1>: Modem Identifier: ATI -- Manufacturer: HuaWei
ttyACM1<*1>: Speed 4800: AT -- OK
ttyACM1<*1>: Speed 9600: AT -- OK
ttyACM1<*1>: Speed 19200: AT -- OK
ttyACM1<*1>: Speed 38400: AT -- OK
ttyACM1<*1>: Speed 57600: AT -- OK
ttyACM1<*1>: Speed 115200: AT -- OK
ttyACM1<*1>: Speed 230400: AT -- OK
ttyACM1<*1>: Speed 460800: AT -- OK
ttyACM1<*1>: Max speed is 460800; that should be safe.
ttyACM1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
WvModem<*1>: Cannot get information for serial port.
ttyACM2<*1>: ATQ0 V1 E1 -- OK
ttyACM2<*1>: ATQ0 V1 E1 Z -- OK
ttyACM2<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyACM2<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyACM2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyACM2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyACM2<*1>: Modem Identifier: ATI -- Manufacturer: HuaWei
ttyACM2<*1>: Speed 4800: AT -- OK
ttyACM2<*1>: Speed 9600: AT -- OK
ttyACM2<*1>: Speed 19200: AT -- OK
ttyACM2<*1>: Speed 38400: AT -- OK
ttyACM2<*1>: Speed 57600: AT -- OK
ttyACM2<*1>: Speed 115200: AT -- OK
ttyACM2<*1>: Speed 230400: AT -- OK
ttyACM2<*1>: Speed 460800: AT -- OK
ttyACM2<*1>: Max speed is 460800; that should be safe.
ttyACM2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found an USB modem on /dev/ttyACM0.
Modem configuration written to /etc/wvdial.conf.
ttyACM0<Info>: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
ttyACM1<Info>: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
ttyACM2<Info>: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
ubuntu@Ubuntu:~$

再修改/etc/wvdial.conf中的相应部分就可以了。我的配置如下:

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Password = any
Phone = *99***1#
Modem Type = USB Modem
Stupid Mode = 1
Baud = 460800
New PPPD = yes
Modem = /dev/ttyACM0
ISDN = 0
username = any
; Phone = <Target Phone Number>
; Password = <Your Password>
; Username = <Your Login Name>

之后,就知道该怎么做了吧? sudo wvdial就OK了。

ubuntu@Ubuntu:~$ sudo wvdial
--> 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 Jun 22 11:11:50 2009
--> Pid of pppd: 4134
--> Using interface ppp0
--> local IP address 10.140.162.111
--> remote IP address 192.200.1.21
--> primary DNS address 221.130.33.60
--> secondary DNS address 221.130.33.52

OK了!

Fedora 10 安装 HuaWei ET128 3G上网卡

 

上网卡型号:HUAWEI ET128

系统版本: Fedora 10

1、首先下载安装usb_modeswitch:

#wget http://www.draisberghof.de/usb_modeswitch/usb_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     (这个要根据lsusb的输出更改)

# choose one of these:
DetachStorageOnly=0
HuaweiMode=1
######################################


其中注意红色部分,是厂商信息和硬件信息,可以通过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


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


3、安装wvdail拨号工具,源里有(据说可以在NetworkManager下使用,但我没配置成功,望达人指教)

#yum install wvdial

执行wvdialconf扫描硬件并生成配置文件:

#wvdialconf

编辑/etc/wvdial.conf配置文件加入如下拨号配置信息:

;########################
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
^MODE: 15
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 20 16:14:15 2009
--> Pid of pppd: 3267
--> 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.50.6
--> 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


注意:

       应当先禁用当前的网卡

       如:ifconfig eth0 down

你可能感兴趣的:(c,linux,ubuntu,internet,interface,login)