Personal tools

Connecting to WiFi network using systemd and wpa-supplicant

From SomLabs Wiki

Revision as of 10:30, 13 October 2022 by KrzysztofChojnowski (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Connecting to WiFi network using systemd and wpa-supplicant

In order to connect to the WiFi network a proper configuration needs to be provided. This tutorial shows how to do this using the wpa_supplicant tool and the systemd service manager.

First, create the /etc/wpa_supplicant directory and the /etc/wpa_supplicant/wpa_supplicant-wlan0.conf file with the following configuration:


  pairwise=CCMP TKIP
  group=CCMP TKIP

The network in the example is protected with the WPA2 standard and requires a password. The <NETWORK_SSID> and <NETWORK_PASSWORD> fields need to be changed according to the existing network configuration.

Create the /etc/systemd/network/ file:



Enable the wpa_service for the wlan0 interface:

systemctl enable wpa_supplicant@wlan0.service

Restart the systemd-networkd and wpa_supplicant services:

systemctl restart systemd-networkd.service
systemctl restart wpa_supplicant@wlan0.service

and check the interface status:

ip a

The wireless network (wlan0) should now be enabled and configured after each system boot:

3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
	link/ether a0:cc:2b:2c:6b:8d brd ff:ff:ff:ff:ff:ff
	inet brd scope global wlan0
	   valid_lft forever preferred_lft forever
	inet6 2a00:f41:581c:fc61:a2cc:2bff:fe2c:6b8d/64 scope global dynamic mngtmpaddr 
	   valid_lft 3574sec preferred_lft 3574sec
	inet6 fe80::a2cc:2bff:fe2c:6b8d/64 scope link 
	   valid_lft forever preferred_lft forever
NXP Partner ST Partner Renesas Partner