如果家里已經(jīng)有一臺臺式機上網(wǎng),那么用藍牙組建無線網(wǎng)絡(luò)可以作為wifi之外的另一選擇。
在linux下對于藍牙PAN(personal area network)的構(gòu)件是非常簡單的
假定你有兩快藍牙適配器
地址分別是:
11:22:33:44:55:66 host
66:55:44:22:22:11 client
========================================================================
對于host(也就是你連接外網(wǎng)的臺式機)
修改/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藍牙適配器ip
修改/etc/network/interfaces
添加
auto bnep0
iface bnep0 inet static
address 192.168.128.1
netmask 255.255.255.0
重啟藍牙服務(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
===================================================================
對于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藍牙適配器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
重啟藍牙服務(wù)
sudo /etc/init.d/bluetooth restart
你就可以通過藍牙上網(wǎng)了,以上在ubuntu 6.10下測試通過
注意藍牙適配器建議買2.0標準理論速度可以達到3Mbps,實際速度在100k左右,基本滿足要求