用户登陆 用户注册
您的位置:首页> 电脑专栏>内容正文
实用技巧:组建Linux下的个人蓝牙局域网
[正文]:用bluetooth 来组建个人的无线局域网,方便,实用而灵活。
  首先需要安装bluez-libs、bluez-utils,还有内核中的bnep模块。
  1: 启动蓝牙hciconfig hci0 up piscan   2: modprobe bnep   *以上步骤,在主机和和客户机上都要操作   3: 在主机上,运行pand --listen --role nap --master   在客户机上,运行pand --connect 00:11:67:46:4e:4e --role napu   4: 当用pand -l 能看到   bnep0 00:11:67:46:4e:4e panu   说明连接成功   5: 在主机上设置ifconfig bnep0 10.10.106.1   在客户机上设置ifconfig bnep0 10.10.106.2   至此,你就可以从10.10.106.2 ping 到10.10.106.1   若需要共享上网,则需要在主机上用iptable来设置一下。
  客户机要添加route   route add -net default gw 10.10.106.1 以下是我的iptable的脚本。
#!/bin/bash iptables='/usr/sbin/iptables' # set interface values extif='ppp0' intif1='bnep0' # enable ip forwarding in the kernel /bin/echo 1 > /proc/sys/net/ipv4/ip_forward # flush rules and delete chains 36;iptables -f 36;iptables -x # enable masquerading to allow lan internet access 36;iptables -t nat -a postrouting -o 36;extif -j masquerade # forward lan traffic from 36;intif1 to internet interface 36;extif 36;iptables -a forward -i 36;intif1 -o 36;extif -m state --state new,established -j accept #echo -e " - allowing access to the ssh server" 36;iptables -a input --protocol tcp --dport 22 -j accept #echo -e " - allowing access to the http server" 36;iptables -a input --protocol tcp --dport 80 -j accept


网站首页 培训课程 维修指南
技术文章 家电专栏 供应信息
求购信息 培训资讯 展会信息
电脑专栏 教程下载 资料下载
常用软件 PLC教程 PLC资料
变频伺服 低压电器 维修资料
人机界面 自控仪表 工控机类
文章标题: 搜文章
中国工控资源网手机版 2012
电话:010-67577139 13811659603
培训咨询QQ:657167934 471895637 销售咨询QQ:623769457
联系邮箱:zggkzyw@163.com
 京ICP备11002135号
报时(2026-04-02 09:12:13) 流量统计