首先,要有一台具备GPRS且带有modem功能的手机,以下以palm treo 650为例。
650是不带modem功能,要通过软件实现,下载 USB modem软件并安装在650上。该软件支持蓝牙和usb数据线两种模式!
下面首先看系统是否能检测到modem
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 -- ENZO
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
Found an USB modem on /dev/ttyACM0.
Modem configuration written to /etc/wvdial.conf.
ttyACM0: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
如果出现以下信息则能检测modem且将配置自动写入 /etc/wvdial.conf文件。你modem的设备文件为/dev/ttyACM0
由于配置文件为普通拨号而建立,所以不适合grps拨号,要作以下修改
[Dialer defaults]
Init1 = at+cgdcont=1,"ip","cmwap"
Modem Type = USB Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/ttyACM0
Username = any
Carrier Check = no
Password = any
Baud = 460800
保存后,使用wvdial拨号
sudo wvdial
使用超级用户操作,不然无法会提示设备忙,或更改用户权限。
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: at+cgdcont=1,"ip","cmwap"
at+cgdcont=1,"ip","cmwap"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
~[7f]}#@!}![06]} }<}!}$}%\}"}&} } } } }#}$@#}%}&}$^[7f]o}'}"}(}"Q}+~
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}![06]} }<}!}$}%\}"}&} } } } }#}$@#}%}&}$^[7f]o}'}"}(}"Q}+~
--> PPP negotiation detected.
--> Starting pppd at Sat Jan 19 10:56:20 2008
--> Pid of pppd: 6967
--> Using interface ppp0
--> pppd: (m[07][08]hr[07][08]
--> pppd: (m[07][08]hr[07][08]
--> pppd: (m[07][08]hr[07][08]
--> pppd: (m[07][08]hr[07][08]
--> pppd: (m[07][08]hr[07][08]
--> local IP address 10.216.91.90
--> pppd: (m[07][08]hr[07][08]
--> remote IP address 10.216.91.0
--> pppd: (m[07][08]hr[07][08]
到如已经成功啦!我们再来看看路由表
$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.216.91.0 * 255.255.255.255 UH 0 0 0 ppp0
192.168.0.0 * 255.255.255.0 U 0 0 0 wlan0
default 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0
因为我这里还连接到无线网络,所以默认网关是 192.168.0.1,如果只有GPRS拨号连接,则信息会是:
$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.216.91.0 * 255.255.255.255 UH 0 0 0 ppp0
default 10.216.91.90 0.0.0.0 UG 0 0 0 ppp0
此时,只需设置代理即可以上网了 代理为 10.0.0.172:80
由于移动限制了浏览器,必须要将浏览器头信息更改才能正常上网。不过已经可以上Q.MSN等聊天工具啦!!