安裝封包
sudo apt-get install hostapd dnsmasq
取消自動啟動
systemctl disable hostapd
systemctl disable dnsmasq
systemctl disable dnsmasq
建立檔案 /etc/hostapd.conf
interface=wlan0
ssid=ShelobsLair
channel=1
ssid=ShelobsLair
channel=1
修改檔案 sudo vim /etc/default/hostapd
DAEMON_CONF="/etc/hostapd.conf" 這一行前面的 # 刪除 取消註解
修改檔案 sudo vim /etc/dnsmasq.conf
interface=wlan0
dhcp-range=192.168.1.10,192.168.1.20,255.255.255.0,12h
dhcp-range=192.168.1.10,192.168.1.20,255.255.255.0,12h
修改檔案 sudo vim /etc/hostapd.conf
interface=wlan0
ssid=[YOUR SSID]
channel=1
ssid=[YOUR SSID]
channel=1
開啟AccessPoint script
#!/bin/bash
service dnsmasq restart
systemctl stop network-manager
systemctl stop wpa_supplicant
service hostapd restart
ifconfig wlan0 192.168.1.1 netmask 255.255.255.0
service dnsmasq restart
systemctl stop network-manager
systemctl stop wpa_supplicant
service hostapd restart
ifconfig wlan0 192.168.1.1 netmask 255.255.255.0
關閉AccessPoint script
#!/bin/bash
service dnsmasq stop
service hostapd stop
systemctl start network-manager
service dnsmasq stop
service hostapd stop
systemctl start network-manager
參考資料
https://forum.armbian.com/index.php?/topic/3046-opi-zero-and-hostapd/&do=findComment&comment=21921
https://blog.gtwang.org/iot/setup-raspberry-pi-as-wireless-access-point/2/
https://blog.gtwang.org/iot/setup-raspberry-pi-as-wireless-access-point/2/