Last edited one month ago

How to configure a WLAN interface on hotspot mode

Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP21x lines, STM32MP23x lines, STM32MP25x lines


1. Configure a wlan interface on hotspot mode[edit | edit source]

WiFi hotspots are internet access points that allow you to connect to a WiFi network using your computer, smartphone or another device while away from your home or office network.

  • Configure the wlan interface for systemd/netword

Add the following rule on /lib/systemd/network/

cat /lib/systemd/network/hostapd.network
[Match]
Name=wlan0

[Network]
Address=192.168.72.1/24
DHCPServer=yes
IPForward=ipv4
IPMasquerade=yes

192.168.72.1/24: ip address affected to the hotspot device.

This configuration supports dhcpserver, ip forward and ip masquerade for this wlan interface: wlan0.

  • Create the hotspot configuration by replacing /etc/hostapd.conf content by the following lines
cat /etc/hostapd.conf
interface=wlan0
driver=nl80211
# mode Wi-Fi (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
hw_mode=g
ssid=STExampleNetwork
channel=7
wmm_enabled=0
macaddr_acl=0
# Wi-Fi closed, need an authentication
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=ExamplePassPhraseNetwork
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

STExampleNetwork is the visible name of the new wlan hotspot (SSID).
ExamplePassPhraseNetwork is the passphare associated to the wlan hotspot (SSID).

If you have network congestion issue on channel 7, you can try other channel (possible value 1-14).

  • Correct one issue with systemd-networkd.service which does not enable the wifi link by default

Add the highlighted line in /lib/systemd/system/hostapd.service file

cat /lib/systemd/system/hostapd.service
[Service]
ExecStartPre=/sbin/ip link set wlan0 up
ExecStart=/usr/sbin/hostapd /etc/hostapd.conf -P /run/hostapd.pid -B
  • Enable systemd service
systemctl enable  hostapd