WiFi Access Point

NOTE: The Raspberry Pi's radio and drivers appear to implement a hard limit at 10 clients.

System Update

apt update
apt upgrade -y

Install hostapd

apt install -y hostapd
systemctl unmask hostapd
systemctl enable hostapd

rfkill unblock wlan

SSID="${network_name}"
PSK="${network_password}"

cat <<EOF > /etc/hostapd/hostapd.conf
ctrl_interface=/var/run/hostapd

country_code=GB
interface=wlan0
bridge=br0

hw_mode=g
ieee80211n=1
wmm_enabled=1
channel=7
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0

wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

ssid=${SSID:-MyNetwork}
wpa_passphrase=${PSK:-SecretPassword}
EOF

Setup Network Bridge

eth0 must be explicitly added to the bridge, hostapd will add wlan0 to the bridge automatically.

cat <<"EOF" > /etc/systemd/network/bridge-br0.netdev
[NetDev]
Name=br0
Kind=bridge
EOF

cat <<"EOF" > /etc/systemd/network/br0-member-eth0.network
[Match]
Name=eth0

[Network]
Bridge=br0
EOF

cat <<"EOF" >> /etc/dhcpcd.conf
denyinterfaces wlan0 eth0
interface br0
EOF

systemctl enable systemd-networkd

Review Status

hostapd_cli status
hostapd_cli all_sta