文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Ubuntu连接到手机蓝牙Modem上网

Ubuntu连接到手机蓝牙Modem上网

时间:2010-10-04  来源:mydear

对大家推荐很好使用的Ubuntu连接系统,像让大家对Ubuntu连接系统有所了解,然后对Ubuntu连接系统全面讲解介绍,希望对大家有用本 文记录了我在Ubuntu连接中通过蓝牙Nokia E71并通过E71作为Modem上网的过程。使用的硬件是安装了Ubuntu 9.04 32位桌面版的IBM T60笔记本;装载联通WCDMA卡的Nokia E71港行(版本号是200开头的)。参考网站:http://davesource.com/Solutions/20070520.T- Mobile-Nokia-E65-Ubuntu-Linux.html (懒得听我废话的直接看这个网站就行了)

声明:这不是一篇技术翻译,只是我自己参考其他站点的内容所实施实践的一个记录。

1、打开手机的蓝牙,并通过Ubuntu连接到手机(这个时候只能浏览手机上的文件)。如果你的电脑有安装蓝牙设备,默认状况下Ubuntu连接的 桌面的右上方的通知栏里面会有蓝牙的图标,如果没有显示的话可以键入以下两个命令确认安装了相关的组件。并通过[系统]>[首选项]>[蓝 牙]的方式呼出连接菜单。

  1. # 安装bluez-utils
  2. % apt-get install bluez-utils
  3. # 如果安装过了的话apt会告知这个时候就直接跳到“安装图形配置工具”
  4. # 如果启动了下载和安装的话就说明原来没有那就继续执行下面的命令:
  5. % /etc/init.d/bluetooth restart
  6. % lsusb | grep -i bluetooth
  7. (should show the bluetooth device)
  8. % hcitool dev
  9. (also lists bluetooth devices) # 安装图形配置工具
    % apt-get install bluez-gnome


2、使用sdptool命令确认你的手机的"Dialup Networking"服务,只要能够找到这个服务基本就没有问题。

  1. # browse后面的MAC地址换成你自己手机的
  2. # 如果不知道MAC地址的话在手机上输入*#2820#
  3. % sdptool browse 11:22:BE:EF:44:33
  4. # 你会得到很多很多输出
  5. ……省略……
  6. Service Name: Dial-Up Networking
  7. Service RecHandle: 0x10002
  8. Service Class ID List:
  9. "Dialup Networking" (0x1103) # 我们只关心这个服务
  10. Protocol Descriptor List:
  11. "L2CAP" (0x0100)
  12. "RFCOMM" (0x0003)
  13. Channel: 2 # 确认这个Channel,一般都是2
  14. Language Base Attr List:
  15. code_ISO639: 0x454e
  16. encoding: 0x6a
  17. base_offset: 0x100
  18. Profile Descriptor List:
  19. "Dialup Networking" (0x1103)
  20. Version: 0x0100
  21. ……省略……

3、利用rfcomm命令绑定设备

  1. # 将0后面的MAC地址换成你自己的(刚才用过了)
  2. # 最后一个数字就是刚才得到的Channel
  3. % rfcomm bind 0 11:22:BE:EF:44:33 2
  4. # 再用一次rfcomm命令确认一下绑定的结果
  5. % rfcomm
  6. rfcomm0: 11:22:BE:EF:44:33 channel 2 clean # 这种输出就对了
  7. # 看一下dev下是不是有了一个rfcomm0的设备
  8. % ls /dev/rf*
  9. /dev/rfcomm0

4、Ubuntu连接编辑pppd的配置文件

  1. # 进入配置文件的存放目录
  2. % cd /etc/ppp/peers
  3. # 通过ls命令可以看到一个名为provider的配置文件模板
  4. # 将其复制一份
  5. % cp provider gprs
  6. # 编辑新的配置文件
  7. % vi gprs

配置文件比较长,本文最后会贴出我用的那个配置文件,这里就说下几个修改项目:

首先有一个user的配置项,我们不需要验证,清空双引号内的内容下面是connect将*****替换为要拨的号码,请替换为*99#(虽然比较 奇怪,但就是这个)后面是device的配置,原本应该是/dev/modem,我们题换成刚刚绑定好的/dev/rfcomm0即可速度的设定我尝试下 来不是非常重要,大家按实际设置吧,我随便设了一个其他的选项不用动了,就这样保存即可。

5、启动连接,启动之前建议关闭现有的Internet(如果有的话),这样才能测试出效果

  1. # 启动连接
  2. % pppd call gprs
  3. # 这个时候手机上应该会出现是否允许连接的认证提示,义无反顾的按下yes吧
  4. # 如果没有任何错误提示就代表成功了
  5. # 用ifconfig命令来确认
  6. % ifconfig
  7. ……省略……
  8. ppp0 Link encap:点对点协议
  9. inet 地址:172.18.77.114 点对点:10.6.6.6 掩码:255.255.255.255
  10. UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 跃点数:1
  11. 接收数据包:4 错误:0 丢弃:0 过载:0 帧数:0
  12. 发送数据包:5 错误:0 丢弃:0 过载:0 载波:0
  13. 碰撞:0 发送队列长度:3
  14. 接收字节:64 (64.0 B) 发送字节:97 (97.0 B)
  15. ……省略……
  16. # 看到ppp0这段就代表确实成功了

开始上网吧,这篇博客就是在手机连接Internet的状态下发表的。Ubuntu连接上这件事确实搞的比较麻烦,不如Windows和OS X。虽然我用的是联通的WCDMA但是如果是移动或者联通的GPRS网络的话应该也能适用完全相同的设定。最后附上我的配置文件:

  1. # example configuration for a dialup connection authenticated with PAP or CHAP
  2. #
  3. # This is the default configuration used by pon(1) and poff(1).
  4. # See the manual page pppd(8) for information on all the options.
  5. # MUST CHANGE: replace myusername@realm with the PPP login name given to
  6. # your by your provider.
  7. # There should be a matching entry with the password in /etc/ppp/pap-secrets
  8. # and/or /etc/ppp/chap-secrets.
  9. user ""
  10. # MUST CHANGE: replace ******** with the phone number of your provider.
  11. # The /etc/chatscripts/pap chat script may be modified to change the
  12. # modem initialization string.
  13. connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T *99#"
  14. # Serial device to which the modem is connected.
  15. /dev/rfcomm0
  16. # Speed of the serial line.
  17. 4096000
  18. # Assumes that your IP address is allocated dynamically by the ISP.
  19. noipdefault
  20. # Try to get the name server addresses from the ISP.
  21. usepeerdns
  22. # Use this connection as the default route.
  23. defaultroute
  24. # Makes pppd "dial again" when the connection is lost.
  25. persist
  26. # Do not ask the remote to authenticate.
  27. noauth

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载