- 論壇徽章:
- 0
|
如果家里已經(jīng)有一臺(tái)臺(tái)式機(jī)上網(wǎng),那么用藍(lán)牙組建無線網(wǎng)絡(luò)可以作為wifi之外的另一選擇。
在linux下對(duì)于藍(lán)牙PAN(personal area network)的構(gòu)件是非常簡單的
假定你有兩快藍(lán)牙適配器
地址分別是:
11:22:33:44:55:66 host
66:55:44:22:22:11 client
========================================================================
對(duì)于host(也就是你連接外網(wǎng)的臺(tái)式機(jī))
修改/etc/default/bluetooth
############ PAND
#
# Run pand -- ethernet: creates new network interfaces bnep
# that can be configured in /etc/network/interfaces
# set to 1 for enabled, 0 for disabled
PAND_ENABLED=1
# Arguments to pand
# Read the PAN howto for ways to set this up
# http://bluez.sourceforge.net/contrib/HOWTO-PAN
PAND_OPTIONS="--listen --master --role NAP"
配置host藍(lán)牙適配器ip
修改/etc/network/interfaces
添加
auto bnep0
iface bnep0 inet static
address 192.168.128.1
netmask 255.255.255.0
重啟藍(lán)牙服務(wù)
sudo /etc/init.d/bluetooth restart
配置網(wǎng)絡(luò)nat
sudo -s
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
===================================================================
對(duì)于client就很簡單了
直接修改
修改/etc/default/bluetooth
############ PAND
#
# Run pand -- ethernet: creates new network interfaces bnep
# that can be configured in /etc/network/interfaces
# set to 1 for enabled, 0 for disabled
PAND_ENABLED=1
# Arguments to pand
# Read the PAN howto for ways to set this up
# http://bluez.sourceforge.net/contrib/HOWTO-PAN
PAND_OPTIONS="--role PANU --connect 11:22:33:44:55:66"
配置client藍(lán)牙適配器ip
修改/etc/network/interfaces
添加
auto bnep0
iface bnep0 inet static
address 192.168.128.10
netmask 255.255.255.0
gateway 192.168.128.1
重啟藍(lán)牙服務(wù)
sudo /etc/init.d/bluetooth restart
你就可以通過藍(lán)牙上網(wǎng)了,以上在ubuntu 6.10下測試通過
注意藍(lán)牙適配器建議買2.0標(biāo)準(zhǔn)理論速度可以達(dá)到3Mbps,實(shí)際速度在100k左右,基本滿足要求
本文來自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u/13673/showart_247333.html |
|