树莓派论坛

 找回密码
 立即注册

[系统与软件] 《 配置电信3G卡USB无线上网》

ApingLai 发表于 2013-4-14 17:43:58 | 显示全部楼层 |阅读模式
本帖最后由 ApingLai 于 2013-4-14 18:17 编辑


《RaspberryPi[树莓派] 配置电信3G卡USB无线上网》


来源 http://www.apinglai.com





1. 查看USB的3G网卡
pi@raspberrypi ~ $ sudo lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 413c:2003 Dell Computer Corp. Keyboard
Bus 001 Device 005: ID 12d1:140c Huawei Technologies Co., Ltd.  #这就是我的3G网卡

pi@raspberrypi ~ $ sudo ls -al /dev/ttyUSB*
crw-rw---T 1 root dialout 188, 0 Apr 14 07:16 /dev/ttyUSB0
crw-rw---T 1 root dialout 188, 1 Jan  1  1970 /dev/ttyUSB1
crw-rw---T 1 root dialout 188, 2 Jan  1  1970 /dev/ttyUSB2

2. 安装wvdial
pi@raspberrypi ~ $ aptitude install usb-modeswitch
pi@raspberrypi ~ $ aptitude install wvdial

3. 修改wvdial配置文件
pi@raspberrypi ~ $ sudo vim /etc/wvdial.conf
  1. [Dialer Defaults]
  2. Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
  3. Modem Type = Analog Modem
  4. Phone = #777
  5. ISDN = 0
  6. Username = card
  7. Init1 = ATZ
  8. Password = card
  9. Modem = /dev/ttyUSB0
  10. Baud = 9600
  11. Stupid Mode = 1
复制代码
3. 启用连接3G网络
pi@raspberrypi ~ $ sudo pon.wvdial
--> WvDial: Internet dialer version 1.61
--> 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 3100000
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Sun Apr 14 07:14:01 2013
--> Pid of pppd: 2280
--> Using interface ppp0
--> pppd: 皑
--> pppd: 皑
--> pppd: 皑
--> pppd: 皑
--> pppd: 皑
--> local  IP address 119.143.117.96
--> pppd: 皑
--> remote IP address 183.41.0.1
--> pppd: 皑
--> primary   DNS address 202.96.128.86
--> pppd: 皑
--> secondary DNS address 202.96.134.133
--> pppd: 皑

4. 已连接成功,测试下
pi@raspberrypi ~ $ ping qq.com
PING qq.com (14.17.32.211) 56(84) bytes of data.
64 bytes from 14.17.32.211: icmp_req=1 ttl=54 time=6.11 ms
64 bytes from 14.17.32.211: icmp_req=2 ttl=54 time=5.88 ms
64 bytes from 14.17.32.211: icmp_req=2 ttl=54 time=5.80 ms

5. 停止3G网络连接
pi@raspberrypi ~ $ sudo killall wvdial
--> Terminating on signal 15
--> pppd: °ϛ01]Іϛ01]
--> Connect time 8.6 minutes.
--> pppd: °ϛ01]Іϛ01]
--> pppd: °ϛ01]Іϛ01]
--> Disconnecting at Sun Apr 14 07:46:15 2013

更多详细请进入 http://www.apinglai.com/category/arm





指尖焰火 发表于 2013-4-14 20:56:12 | 显示全部楼层
收藏了,文章
瀚蓝ゞ. 发表于 2013-5-9 15:29:36 | 显示全部楼层
板凳我占了
pi_user 发表于 2013-5-16 15:33:13 | 显示全部楼层
求教,我是华为其他型号的上网卡,插上后,在sudo ls -al /dev/ttyUSB*后,没有任何ttyUSB信息?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版 | Archiver | 树莓派论坛 ( 粤ICP备15075382号-1 )