Ubuntu连接到手机蓝牙Modem上网

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

对大家推荐很好使用的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.  
  5. # 再用一次rfcomm命令确认一下绑定的结果  
  6. % rfcomm  
  7. rfcomm0: 11:22:BE:EF:44:33 channel 2 clean # 这种输出就对了  
  8.  
  9. # 看一下dev下是不是有了一个rfcomm0的设备  
  10. % ls /dev/rf*  
  11. /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. # 如果没有任何错误提示就代表成功了  
  6. # 用ifconfig命令来确认  
  7. % ifconfig  
  8. ……省略……  
  9. ppp0      Link encap:点对点协议    
  10. inet 地址:172.18.77.114  点对点:10.6.6.6  掩码:255.255.255.255  
  11. UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  跃点数:1  
  12. 接收数据包:4 错误:0 丢弃:0 过载:0 帧数:0  
  13. 发送数据包:5 错误:0 丢弃:0 过载:0 载波:0  
  14. 碰撞:0 发送队列长度:3   
  15. 接收字节:64 (64.0 B)  发送字节:97 (97.0 B)  
  16. ……省略……  
  17. # 看到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.  
  6. # MUST CHANGE: replace myusername@realm with the PPP login name given to  
  7. # your by your provider.  
  8. # There should be a matching entry with the password in /etc/ppp/pap-secrets  
  9. # and/or /etc/ppp/chap-secrets.  
  10. user ""  
  11.  
  12. # MUST CHANGE: replace ******** with the phone number of your provider.  
  13. # The /etc/chatscripts/pap chat script may be modified to change the  
  14. # modem initialization string.  
  15. connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T *99#"  
  16.  
  17. # Serial device to which the modem is connected.  
  18. /dev/rfcomm0  
  19.  
  20. # Speed of the serial line.  
  21. 4096000  
  22.  
  23. # Assumes that your IP address is allocated dynamically by the ISP.  
  24. noipdefault  
  25. # Try to get the name server addresses from the ISP.  
  26. usepeerdns  
  27. # Use this connection as the default route.  
  28. defaultroute  
  29.  
  30. # Makes pppd "dial again" when the connection is lost.  
  31. persist  
  32.  
  33. # Do not ask the remote to authenticate.  
  34. noauth 

【编辑推荐】

  1. 手机蓝牙打开Ubuntu连接全程服务
  2. 桌面Linux实战“宝典” 用Ubuntu连接孤岛
  3. Ubuntu 9.10基本工作与受限软件
  4. Ubuntu 8.04配置安装用XP直接引导
  5. Ubuntu VMware检查硬件声卡驱动管理安装
责任编辑:佚名 来源: CSDN
相关推荐

2010-01-08 15:35:30

Ubuntu连接

2011-09-05 18:45:45

UbuntuUSB

2020-02-17 09:06:16

GSConnectFedora应用

2019-11-08 10:00:09

Windows手机应用程序

2022-10-28 11:41:57

2021-06-02 00:15:41

C# PC蓝牙

2009-12-15 18:24:02

Ruby连接到orac

2011-09-08 11:07:25

Ubuntu蓝牙

2009-12-15 18:15:24

Ruby连接到LDAP

2010-03-29 17:08:03

蓝牙无线上网

2023-04-17 16:10:14

鸿蒙蓝牙

2011-07-06 11:33:51

ModemADSL优化

2009-12-29 11:11:19

2017-06-13 10:30:20

oracle连接命名

2023-03-08 21:30:33

2015-05-05 14:57:30

Win10

2011-12-14 20:54:24

Android

2010-01-06 17:36:40

Ubuntu 9.10

2010-04-01 17:43:26

SimmbookUbuntu

2009-03-06 15:27:10

LinuxUbuntuBlueman
点赞
收藏

51CTO技术栈公众号