歡迎您光臨本站 註冊首頁

linux下通過藍牙手機上網

←手機掃碼閱讀     火星人 @ 2014-03-12 , reply:0
  
手機:sony ericsson K750C 開通了GPRS
系統:redflag linux desktop 5.0
所用的工具:
pppd(用來撥號的)
rfcomm(用來連接手機撥號服務)
需要的配置文件有2個:
1:/etc/ppp/gprs

內容如下:
/dev/rfcomm0
230400
defaultroute
usepeerdns
user ''
password bobo
nodetach
crtscts
lock
noauth
local
debug
connect "/usr/sbin/chat -v -f /etc/ppp/chat-gprs"

2:/etc/ppp/chat-gprs

TIMEOUT 10
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'ERROR'
"" 'ATZ'
OK 'AT+CGDCONT=3,"IP","internet3.voicestream.com" '
ABORT 'NO CARRIER'
SAY 'Dialing....\n'
OK 'ATD*99***1#'
CONNECT ''

建立好上述2個文件,執行下面的命令:
1:hcitool scan

取得藍牙手機地址 00:16:20:31:6C:A8

2:sdptool browser 00:16:20:31:6C:A8

輸出如下:
ervice Name: Dial-up Networking
Service RecHandle: 0x10001
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

3:rfcomm bind 0 00:16:20:31:6C:A8 1

4 pppd call gprs
輸出如下:
Serial connection established.
using channel 25
Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm0
rcvd [LCP ConfReq id=0x1 ]
sent [LCP ConfReq id=0x1 ]
sent [LCP ConfAck id=0x1 ]
rcvd [LCP ConfReq id=0x2 ]
sent [LCP ConfAck id=0x2 ]
rcvd [LCP ConfAck id=0x1 ]
sent [PAP AuthReq id=0x1 user="localhost" password=]
rcvd [PAP AuthAck id=0x1 "Congratulations!"]
Remote message: Congratulations!
sent [IPCP ConfReq id=0x1 ]
sent [CCP ConfReq id=0x1 ]
rcvd [LCP ProtRej id=0x1 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
rcvd [IPCP ConfReq id=0x1]
sent [IPCP ConfNak id=0x1 ]
rcvd [IPCP ConfNak id=0x1 ]
sent [IPCP ConfReq id=0x2 ]
rcvd [IPCP ConfReq id=0x2]
sent [IPCP ConfAck id=0x2]
rcvd [IPCP ConfAck id=0x2 ]
Could not determine remote IP address: defaulting to 10.64.64.64
not replacing existing default route to eth0 [172.16.80.1]
local IP address 10.12.93.62
remote IP address 10.64.64.64
primary DNS address 221.130.33.52
secondary DNS address 221.130.33.60
Script /etc/ppp/ip-up started (pid 29502)
Script /etc/ppp/ip-up finished (pid 29502), status = 0x0

最後修改/etc/resolv.conf

nameserver 221.130.33.52
search localhost

啟動網路瀏覽器即可通過藍牙手機上網了

PS:如果第一次連接,會要求輸入PIN,匹配上后,重新做上述
的命令即可


[火星人 ] linux下通過藍牙手機上網已經有711次圍觀

http://coctec.com/docs/linux/show-post-67610.html