Wifi SystemdNetworkd: Difference between revisions
No edit summary |
No edit summary |
||
Line 74: | Line 74: | ||
=== Connecting to a protected WiFi network === | === Connecting to a protected WiFi network === | ||
Create /etc/systemd/network/80-wifi-station.network | Create /etc/systemd/network/80-wifi-station.network as following: | ||
<pre> | <pre> | ||
# cp /lib/systemd/network/80-wifi-station.network.example /etc/systemd/network/80-wifi-station.network | # cp /lib/systemd/network/80-wifi-station.network.example /etc/systemd/network/80-wifi-station.network | ||
</pre> | </pre> | ||
Append the following content to /etc/systemd/network/80-wifi-station.network: | |||
<pre> | <pre> | ||
"[DHCPv4] | |||
"RouteMetric=9" | |||
"[IPv6AcceptRA]" | |||
"RouteMetric=9" | |||
</pre> | |||
Create /etc/wpa_supplicant/wpa_supplicant-wlan0.conf with the following content: | |||
<pre> | |||
"ctrl_interface=/var/run/wpa_supplicant" | |||
"eapol_version=1" | |||
"ap_scan=1" | |||
"fast_reauth=1" | |||
wpa_passphrase <SSID> <password> | |||
</pre> | </pre> | ||
Line 107: | Line 110: | ||
<pre> | <pre> | ||
# ifconfig wlan0 | # ifconfig wlan0 | ||
</pre> | |||
== Configuring WiFi access point with hostapd == | |||
hostapd is a versatile tool for setting up a WiFi access point and generally offers more options and flexibility compared to NetworkManager.<br> | |||
For instance, hostapd enables the creation of a WiFi 6 access point, which is not currently possible with NetworkManager. | |||
udhcpd is a suitable option for providing DHCP services alongside hostapd. It's a lightweight DHCP server that can be easily integrated with hostapd. | |||
=== Create /etc/hostapd.conf === | |||
The next step is to create /etc/hostapd.conf. The following table shows how to configure 802.11bgn, 802.11ac, and 802.11ax access points: | |||
{| class="wikitable" | |||
|- | |||
! Wi-Fi 2.4GHz (802.11bgn)<br>/etc/hostapd.conf | |||
! Wi-Fi 5 (802.11ac)<br>/etc/hostapd.conf | |||
! Wi-Fi 6 (802.11ax)<br>/etc/hostapd.conf | |||
|- | |||
| {{HOSTAPD_BGN}} | |||
| {{HOSTAPD_AC}} | |||
| {{HOSTAPD_AX}} | |||
|} | |||
Add the Control interface directory and group to /etc/hostapd.conf: | |||
<pre> | |||
# Control interface directory and group | |||
ctrl_interface=/var/run/hostapd | |||
ctrl_interface_group=0 | |||
</pre> | </pre> |
Revision as of 15:13, 21 October 2024
This page is using the default release mx95-yocto-scarthgap-6.6.23_2.0.0-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
DART-MX95 Overview
The DART-MX95 supports the following WiFi modules:
Module | Chipset | Features | Network Interface(s) |
---|---|---|---|
Sterling LWB | Cypress CYW4343W | 802.11 b/g/n | wlan0 |
Sterling LWB5 | Cypress CYW43353 | 802.11 ac/a/b/g/n, | wlan0 |
Murata LBEE5PL2DL | NXP IW611 | 802.11 a/ac/ax/b/g/n | wlan0, uap0, wfd0 |
Murata LBES5PL2EL | NXP IW612 | 802.11 a/ac/ax/b/g/n, 802.15.4 | wlan0, uap0, wfd0 |
This guide demonstrates how to configure WiFi using systemd-networkd. It is important to use the correct network interface for the module assembled on your DART-MX95.
Managing WiFi using systemd-networkd
systemd-networkd is a system daemon that manages network configurations. It detects and configures network devices as they appear.
systemd-networkd's functionality can be useful for both wireless and wired networks.
This guide describes how to use systemd-networkd to configure wireless networks.
Enabling and disabling WiFi
To enable WiFi run
# networkctl up wlan0
To disable WiFi run
# networkctl down wlan0
Configuring WiFi Client
Scanning for available WiFi APs
If WiFi is enabled you can get the list of available APs by running
# iw dev wlan0 scan | grep SSID
Connecting to a protected WiFi network
Create /etc/systemd/network/80-wifi-station.network as following:
# cp /lib/systemd/network/80-wifi-station.network.example /etc/systemd/network/80-wifi-station.network
Append the following content to /etc/systemd/network/80-wifi-station.network:
"[DHCPv4] "RouteMetric=9" "[IPv6AcceptRA]" "RouteMetric=9"
Create /etc/wpa_supplicant/wpa_supplicant-wlan0.conf with the following content:
"ctrl_interface=/var/run/wpa_supplicant" "eapol_version=1" "ap_scan=1" "fast_reauth=1" wpa_passphrase <SSID> <password>
Restart the services
# systemctl restart systemd-networkd.service # systemctl restart wpa_supplicant@wlan0.service
Wait a few seconds and than make sure wlan0 is up and connected to the AP
# ifconfig wlan0
Configuring WiFi access point with hostapd
hostapd is a versatile tool for setting up a WiFi access point and generally offers more options and flexibility compared to NetworkManager.
For instance, hostapd enables the creation of a WiFi 6 access point, which is not currently possible with NetworkManager.
udhcpd is a suitable option for providing DHCP services alongside hostapd. It's a lightweight DHCP server that can be easily integrated with hostapd.
Create /etc/hostapd.conf
The next step is to create /etc/hostapd.conf. The following table shows how to configure 802.11bgn, 802.11ac, and 802.11ax access points:
Wi-Fi 2.4GHz (802.11bgn) /etc/hostapd.conf |
Wi-Fi 5 (802.11ac) /etc/hostapd.conf |
Wi-Fi 6 (802.11ax) /etc/hostapd.conf |
---|---|---|
# /etc/hostapd.conf for 2.4 GHz (802.11b/g/n) # AP Net Interface interface=uap0 # 2.4 GHz hw_mode=g # Enable 802.11n (Wi-Fi 4) standard ieee80211n=1 wmm_enabled=1 # Demo was run in the US country_code=US # Our SSID ssid=Var_AP_2G # Automatically select the best channel # Notes about the LWB/LWB5 modules: # - For AP+STA, the channel must match the STA channel # - The LWB does not support auto channel selection. # We recommend using channel 1 channel=0 |
# /etc/hostapd.conf for Wi-Fi 5 (802.11ac) # AP Net Interface interface=uap0 # 5 GHz hw_mode=a # Enable 802.11ac (Wi-Fi 5) standard ieee80211ac=1 wmm_enabled=1 # Demo was run in the US country_code=US # Our SSID ssid=Var_AP_Wifi5 # Automatically select the best channel # Notes about the LWB/LWB5 modules: # - For AP+STA, the channel must match the STA channel # - The LWB5 does not support auto channel selection. # For LWB5, we recommend using channel 36. channel=0 |
# /etc/hostapd.conf for Wi-Fi 6 (802.11ax) # AP Net Interface interface=uap0 # 5 GHz hw_mode=a # Enable 802.11ax (Wi-Fi 6) standard ieee80211ax=1 wmm_enabled=1 # Demo was run in the US country_code=US # Our SSID ssid=Var_AP_Wifi6 # Automatically select the best channel channel=0 |
Add the Control interface directory and group to /etc/hostapd.conf:
# Control interface directory and group ctrl_interface=/var/run/hostapd ctrl_interface_group=0