魅力博客

魅力Linux|魅力空间|魅力博客|学习Linux|ubuntu日记|电脑教程|手机软件

ubuntu通过蓝牙适配器连接手机GPRS上网



昨晚搞定ubuntu通过蓝牙适配器连接手机GPRS上网,以下详细过程供大家参考

1.确保手机蓝牙功能开启
2.安装: sudo apt-get install gnome-bluetooth blue-utils
3.打开终端
[code]hcitool scan
会查找到手机蓝牙地址,比如我的是00:12:62:59:4F:A5

4.接上一步
[code]sdptool search DUN
注意显示的channel号,我的是2

5.手机跟电脑配对请参看[url]http://forum.ubuntu.org.cn/viewtopic.php?t=43475&highlight=%E8%93%9D%E7%89%99
这里有详细的说明。

6.
[code] rfcomm bind /dev/rfcomm0 X:X:X:X:X:X channel号
7.新建 gksudo gedit /etc/ppp/peers/BluetoothDialup
[code]debug
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/BluetoothDialup"
usepeerdns
/dev/rfcomm0 115200
defaultroute
crtscts
lcp-echo-failure 0
8.新建gksudo gedit /etc/chatscripts/BluetoothDialup
[code]TIMEOUT 35
ECHO ON
ABORT '\nBUSY\r'
ABORT '\nERROR\r'
ABORT '\nNO ANSWER\r'
ABORT '\nNO CARRIER\r'
ABORT '\nNO DIALTONE\r'
ABORT '\nRINGING\r\n\r\nRINGING\r'
'' \rAT
OK 'AT+CGDCONT=1,"IP","cmwap"'(我的是移动任我行20包月,接入点是cmwap)
OK ATD*99***1#
CONNECT ""

到这里,配置已经完成,接着就是连接gprs了
[code]pon BluetoothDialup
呵呵大功告成,pidgin中msn可以用代理上,可qq没有搞定
firefox貌似不能通过cmwap打开网页,只好用opera,opera中设置好代理,就能打开网页啦。
====================================================
我在按照前面的步骤运行后,能让手机拨号,但是并不能打开任何网页,这是因为笔记本路由设置不正确。

打开终端,输入ifconfig,会看到以下的内容

……..
ppp0 Link encap:Point-to-Point Protocol
inet addr:10.72.88.180 P-t-P:10.6.6.6 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:64 (64.0 b) TX bytes:97 (97.0 b)
……..

这里的inet addr:10.72.88.180就是你刚才拨号后分配的IP地址,P-t-P:10.6.6.6就是你的网关地址

此时输入route,会看到以下内容

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
link-local * 255.255.0.0 U 1000 0 0 eth1
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth1

你会看到默认路由是192.168.1.1,需要把默认路由改成手机拨号后得到的网关地址,也就是10.6.6.6

输入sudo route delete default

删除原来的默认路由

输入sudo route add default gw 10.6.6.6

增加一个默认路由

之后,你就能顺利打开任何网页了。

拨号的命令是pon BluetoothDialup,断开拨号的命令是poff BluetoothDialup



返回顶部

发表评论:

Powered By Z-BlogPHP 1.7.3


知识共享许可协议
本作品采用知识共享署名 3.0 中国大陆许可协议进行许可。
网站备案号粤ICP备15104741号-1