树莓派ap配置

一、安装hostapd和dnsmasq软件包

sudo apt-get install dnsmasq hostapd

二、接口配置

1.dhcpcd配置文件

sudo vim /etc/dhcpcd.conf

并在文件的最后一行添加以下内容:

denyinterfaces wlan0

2.interfaces配置文件

sudo vim /etc/network/interfaces

编辑wlan0部分内容,他看起来像这样:

allow-hotplug wlan0 

iface wlan0 inet static 
    address 192.168.10.1
    netmask 255.255.255.0
    network 192.168.10.0
    broadcast 192.168.10.255

#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

3.配置HOSTAPD

创建一个新的配置文件vim /etc/hostapd/hostapd.conf,然后加入以下内容:

interface=wlan0    # This is the name of the WiFi interface we configured above

driver=nl80211    # Use the nl80211 driver with the brcmfmac driver

ssid=RaspberryPi3    # This is the name of the network

hw_mode=g    # Use the 2.4GHz band

channel=6    # Use channel 6

ieee80211n=1    # Enable 802.11n

wmm_enabled=1    # Enable WMM

ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]    # Enable 40MHz channels with 20ns guard interval

macaddr_acl=0    # Accept all MAC addresses

auth_algs=1    # Use WPA authentication

ignore_broadcast_ssid=0    # Require clients to know the network name

wpa=2    # Use WPA2

wpa_key_mgmt=WPA-PSK    # Use a pre-shared key

wpa_passphrase=raspberry    # The network passphrase

rsn_pairwise=CCMP    # Use AES, instead of TKIP

打开默认的配置文件vim /etc/default/hostapd并找到#DAEMON_CONF=""将他替换成这DAEMON_CONF="/etc/hostapd/hostapd.conf"

4.配置DNSMASQ

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf_bak
sudo vim /etc/dnsmasq.conf 

复制粘贴下面的内容进新的文件:

interface=wlan0      # Use interface wlan0 

listen-address=192.168.10.1 # Explicitly specify the address to listen on 

bind-interfaces      # Bind to the interface to make sure we aren't sending things elsewhere 

server=8.8.8.8       # Forward DNS requests to Google DNS 

domain-needed        # Don't forward short names 

bogus-priv           # Never forward addresses in the non-routed address spaces. 

dhcp-range=192.168.10.2,192.168.10.254,12h # Assign IP addresses between 192.168.10.2 and 192.168.10.254 with a 12 hour lease time 

参考地址

使用HOSTAPD使你的树莓派3成为WiFi热点(AP)

树莓派Pi3设置wifi热点

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值