Connecting to WiFi network using systemd and wpa-supplicant
From SomLabs Wiki
Connecting to WiFi network on VisionSOM-STM32MP1
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.
First, open the /etc/wpa_supplicant.conf file and provide the network configuration:
ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 update_config=1 network={ ssid="<NETWORK_SSID>" psk="<NETWORK_PASSWORD>" key_mgmt=WPA-PSK proto=WPA2 pairwise=CCMP TKIP group=CCMP TKIP scan_ssid=1 }
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/network/interfaces file and configure the wlan0 interface with the DHCP client:
auto wlan0 iface wlan0 inet dhcp wireless_mode managed wireless_essid any wpa-driver nl80211 wpa-conf /etc/wpa_supplicant.conf
Enable the wlan0 interface by calling:
ifup wlan0
and check the interface status:
ip a
The wireless network (wlan0) should now be enabled and configured:
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 192.168.43.234/24 brd 192.168.43.255 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