树莓派 3 - 配置为无线接入点 -AP 模式

来自 Alpine Linux
Todo: 待办事项:raspberrypi-libs 软件包是否已重命名... 或者它是否仍然是必需的?


安装必要的固件

apk add linux-firmware-brcm raspberrypi-libs


安装 hostapd 和 dnsmasq

apk add hostapd dnsmasq

配置 /etc/hostapd/hostapd.conf

interface=wlan0
driver=nl80211
ssid=Pi3-AP
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=raspberry
rsn_pairwise=CCMP
wpa_pairwise=CCMP

配置你的 /etc/dnsmasq.conf

interface=wlan0
dhcp-range=10.0.0.2,10.0.0.5,255.255.255.0,12h

在文件 /etc/network/interfaces 中为 wlan0 配置静态 IP

auto wlan0
iface wlan0 inet static
  address 10.0.0.1
  netmask 255.255.255.0

启动服务

service dnsmasq start
service hostapd start

永久启用服务,使其在每次启动时都运行

rc-update add dnsmasq     
rc-update add hostapd 

(待删除)

rc-update del dnsmasq     
rc-update del hostapd 

(或)

rc-update add dnsmasq boot    
rc-update add hostapd boot    

(待删除)

rc-update del dnsmasq boot    
rc-update del hostapd boot

提交所有文件更改

请确保运行下面显示的命令以提交所有更改,否则重启后这些更改将会丢失。

lbu ci

参考

https://gist.github.com/atlury/fe0ea8b91a981c103df7

https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/[Dead Link]

感谢 oneinsect@gmail.com