Linux通过手机上网
1.安装相关软件
;sudo apt-get install wvdial
2.得到GPRS的IP地址
;(1)
;手机调整到usb lan模式,在手机打开一个网页,让它的GPRS连通
;(2)
;运行 sudo /sbin/ifconfig
;确认usb0存在
;(3)
;运行 sudo /sbin/ifconfig usb0 192.168.1.1
;配置电脑上的usb0的IP为192.168.1.1
;(4)
;运行 telnet 192.168.1.2
;telnet到手机,其中192.168.1.2为手机usb lan的IP,如下
$ telnet 192.168.1.2
;Trying 192.168.1.2...
;Connected to 192.168.1.2.
;Escape character is "^]".
;;;;
;MontaVista(R) Linux(R) Consumer Electronics Edition 3.1
;Linux/armv5tel 2.4.20_mvlcee31-mainstone_pxa27x
;(none) login: root
;MontaVista(R) Linux(R) Consumer Electronics Edition 3.1
No directory /root!
;Logging in with home = "/".
;# ifconfig
;gprsv2;Link encap:Point-to-Point Protocol
;;;inet addr:10.9.139.175; P-t-P:10.112.112.112; Mask:255.255.255.255
;;;UP POINTOPOINT RUNNING NOARP MULTICAST; MTU:1500; Metric:1
;;;RX packets:0 errors:0 dropped:0 overruns:0 frame:0
;;;TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
;;;collisions:0 txqueuelen:50
;;;RX bytes:8991 (8.7 Kb); TX bytes:5117 (4.9 Kb)
lo;;;;;Link encap:Local Loopback
;;;inet addr:127.0.0.1; Mask:255.0.0.0
;;;UP LOOPBACK RUNNING; MTU:16436; Metric:1
;;;RX packets:24 errors:0 dropped:0 overruns:0 frame:0
;;;TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
;;;collisions:0 txqueuelen:0
;;;RX bytes:1392 (1.3 Kb); TX bytes:1392 (1.3 Kb)
gprsv2;Link encap:Point-to-Point Protocol
;;;inet addr:10.10.88.48; P-t-P:10.112.112.112; Mask:255.255.255.255
;;;UP POINTOPOINT RUNNING NOARP MULTICAST; MTU:1500; Metric:1
;;;RX packets:0 errors:0 dropped:0 overruns:0 frame:0
;;;TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
;;;collisions:0 txqueuelen:50
;;;RX bytes:1025 (1.0 Kb); TX bytes:1023 (1023.0 b)
# exit
;Connection closed by foreign host.
;$
;(5)
;由(4)得到gprsv2的IP为10.10.88.48,记录下来
3.为pppd添加GPRS IP
;(1)
;运行 sudo gedit /etc/ppp/options
;在options文件的最后一行添加如下两行内容
;novj
;:10.10.88.48
;其中10.10.88.48为2.(5)所得到的GPRS IP地址
4.配置/etc/wvdial.conf并连接上网
;(1)
;关掉手机的网页,确认手机上的GPRS连接已经断开
;(2)
;手机调整到usb modem模式
;(3)
;运行 wvdialconf
;检测手机的modem连接是否正常,程序自动创建/etc/wvdial.conf文件,正确情况如下
$ wvdialconf
;Editing `/etc/wvdial.conf".
Scanning your serial ports for a modem.
WvModem<*1>: Cannot set information for serial port.
;ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
;ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
;ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
;Modem Port Scan<*1>: S1S2S3
;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 &D2FCLASS=0 -- OK
;ttyACM0<*1>: Modem Identifier: ATI -- ERROR
;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
推荐阅读
- Ubuntu Linux---GNU libc库
- SELinux Linux安全新高度 安全增强Linux 剖析
- linux实用系统管理命令回顾
- 永远不要运行的危险Linux命令!
- LINUX下tar.gz包的安装方法
- Unix/Linux中的shell 机制
- linux系统性能检测
- linux系统优化
- 基于Linux的VOIP开放协议和专有协议
- winxp系统中将阿尔巴尼亚语输入法删掉具体操作步骤