小R科技-WIFI机器人网·机器人创意工作室

 找回密码
 立即注册
查看: 8689|回复: 2

树莓派3 设置AP热点模式

[复制链接]
发表于 2017-1-20 18:07:03 | 显示全部楼层 |阅读模式
1、安装Hostapd,dnsmasq:
  1. sudo apt-get install hostapd dnsmasq
复制代码
2、然后在/etc/dnsmasq.conf末加入(自己修改IP和网段,这个文件是已存在的,很详细的配置文件,但是所有行都加入了#号注释掉)
  1. interface=wlan0
  2. dhcp-range=10.0.0.2,10.0.0.5,255.255.255.0,12h
复制代码
3、新建/etc/hostapd/hostapd.conf,加入如下内容:
  1. interface=wlan0
  2. hw_mode=g
  3. channel=10
  4. auth_algs=1
  5. wpa=2
  6. wpa_key_mgmt=WPA-PSK
  7. wpa_pairwise=CCMP
  8. rsn_pairwise=CCMP
  9. wpa_passphrase=wifi密码
  10. ssid=wifi名字
复制代码
4、修改/etc/sysctl.conf,更改(如果有这一行,把#号去掉就行):
  1. net.ipv4.ip_forward=1
复制代码
5、将下面脚本加入到/etc/rc.local的exit 0前面位置:
  1. ifconfig wlan0 down
  2. ifconfig wlan0 10.0.0.1 netmask 255.255.255.0 up
  3. iwconfig wlan0 power off
  4. service dnsmasq restart
  5. hostapd -B /etc/hostapd/hostapd.conf & > /dev/null 2>&1
  6. sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE  
  7. sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT  
  8. sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
复制代码

回复

使用道具 举报

发表于 2017-8-21 21:26:43 | 显示全部楼层
连接成功的标志是什么?后面还有关于把树莓派做热点的内容吗?
回复 支持 反对

使用道具 举报

发表于 2017-10-18 22:33:27 | 显示全部楼层
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
hostapd_free_hapd_data: Interface wlan0 wasn't started
怎么解决
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

新品特惠推荐上一条 /2 下一条

QQ|QQ技术咨询1|QQ技术咨询2|商务合作微信1:xiaorgeek001|商务合作微信2:XiaoRGEEK|诚聘英才|Archiver|手机版|小R科技-WIFI机器人网·机器人创意工作室 ( 粤ICP备15000788号-6 )

GMT+8, 2024-11-22 23:37 , Processed in 1.112447 second(s), 19 queries .

Powered by XiaoR GEEK X3.4

© 2014-2021 XiaoR GEEK

快速回复 返回顶部 返回列表