0%

centos 配置蓝牙共享网络

安装centos蓝牙库:

1
yum install bluez.x86_64 bluez-compat.x86_64

安装蓝牙认证库:

1
yum -y install pygobject2 dbus-python-devel.x86_64 dbus-python

配置dhcpd:

1
2
3
4
5
6
7
8
9
10
11
vim /etc/dhcp/dhcpd.conf

ignore client-updates;

subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 10.16.0.222;

range dynamic-bootp 10.0.0.10 10.0.0.50;
}

上网设置:

1
2
3
4
5
6
7
8
9
10
11
12
13
brctl addbr pan1
brctl stp pan1 off
echo "1">/proc/sys/net/ipv4/ip_forward
ifconfig pan1 10.0.0.1/24
iptables -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE
#iptables -D FORWARD 1
#watch -n 1 iptables -L -n -v
/etc/init.d/dhcpd restart

hciconfig hci0 up piscan
modprobe bnep
pand --listen --role NAP --master
nohup python /root/src/simple-agent.py > /tmp/blue-agent.log 2>&1