Approved version. Approved on: 12:06, 15 June 2022
- Last edited 11 months ago ago
How to configure a WLAN interface on hotspot mode
Revision as of 12:06, 15 June 2022 by Nathalie Sangouard (talk | contribs) (Nathalie Sangouard moved page How to configure a wlan interface on hotspot mode to How to configure a WLAN interface on hotspot mode without leaving a redirect)
Configure a wlan interface on hotspot mode
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).
- 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