闲话少说,没有网络是很难过的,家里、单位都有网络,但偶尔没网的地方又想上网,就要充分利用手机的上网包月流量。
本人手机:n97mini(只要支持蓝牙就行,呵呵)
笔记本(laptop):华硕A2400(老爷机,256M内存,debian6)
蓝牙适配器:Henkel,不知道,反正手机上显示ISSCBTM,这个linux应该没问题
参考文档:首先当然是在官方wiki找:http://wiki.debian.org/UseYourCellPhoneAsModem,用连接线可以了,但是用蓝牙却不行,考虑是不是没开蓝牙拨号服务,因为在windows下可以,但一直没找到怎么看的方法。左搜右搜,最后终于在这篇文档上找到了答案:http://davesource.com/Solutions/20070520.T-Mobile-Nokia-E65-Ubuntu-Linux.html。原因很简单,因为手机不同,所以DUN(Dial Up Networking)服务对应的rfcomm端口不同,官方文档的是用2端口,见命令:rfcomm connect 0 11:22:33:44:55:66 2 &,后接&表示在后台运行,我的手机却是在22端口,这是用sdptool命令查到的,后面会说。好,下面就上操作步骤(参考官方文档,略加修改):
1、首先查看、安装蓝牙服务。
# /etc/init.d/bluetooth status
bluetooth is running
没有请安装
#aptitude install bluetooth 或者 启动# /etc/init.d/bluetooth start
有些是这个命令,随便
#apt-get install bluez-utils(bluez) (在testing/unstable, bluez代替bluez-utils).
2、插上蓝牙适配器,查看识别情况,一般没问题。
#lsusb | grep -i bluetooth
(should show the bluetooth device)
Bus 004 Device 003: ID 1131:1001 Integrated System Solution Corp.
KY-BT100 Bluetooth Adapter
#hcitool dev
(also lists bluetooth devices)
[Dialer usb]
Modem Type = USB Modem
Modem = /dev/ttyACM0
[Dialer blz]
Modem = /dev/rfcomm0
然后用ifconfig命令将连网设备down。
5、手机usb数据线拨号上网。
# wvdial usb &
6、手机蓝牙拨号上网还需要配置rfcomm参数。
前面用hcitool dev命令看到了蓝牙适配器,下面用hcitool scan命令搜索手机。
Scanning...
00:11:22:33:44:55 NameDevice (这显示的是你的手机mac地址和名字)
或者在手机上拨号"*#2820#",得到手机的mac地址。然后用命令sdptool search dun或者sdptool browse 00:11:22:33:44:55(这里用你手机的mac地址)查找你手机拨号服务的rfcomm端口。
sdptool search dun
Service Name: Dial-Up Networking
Service RecHandle: 0x1001e
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003) Channel: 2
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100
主要看channel的号码,我的手机是22,所以后面我修改rfcomm.conf端口号为22。我的文件/etc/bluetooth/rfcomm.conf内容。
rfcomm0 {
# # Automatically bind the device at startup
# bind no;
#
# # Bluetooth address of the device
device e4:ec:10:d5:f4:ab;
#
# # RFCOMM channel for the connection
channel 22;
#
# # Description of the connection
comment "wvdial connect blz";
}
rfcomm1 {
# # Automatically bind the device at startup
# bind no;
#
# # Bluetooth address of the device
device e4:ec:10:d5:f4:ab;
#
# # RFCOMM channel for the connection
channel 1;
#
# # Description of the connection
comment "Example Bluetooth device";
}