Wi-Fi
This chapter describes common information and instructions of Wi-Fi on IoT Yocto, such as command to configure DHCP or static IP and so on.
But Wi-Fi on different platforms may have some platform-specific instructions or test results. For example, you will get different throughputs on different platforms.
Connect to a Wi-Fi AP
There are two methods to connect evaluation board to a Wi-Fi network: NetworkManager and wpa_supplicant.
NetworkManager is a high level service and should be used when possible, since it automatically configures wpa_supplicant and other system states.
Connect to a network via NetworkManager
First, make sure service NetworkManager (NetworkManager
) is running:
systemctl status NetworkManager.service
You should see an output line like this:
Active: active (running)
If not, launch NetworkManager:
systemctl start NetworkManager.service
Now, please remove the old config file from /etc/wpasupplicant.conf
, if wpa_supplicant
has been used before.
This configuration file interferes NetworkManager.
rm -rf /etc/wpasupplicant.conf
Finally, run nmcli
command to configure and connect the board to WIFI with NetworkManager:
Note
Interface name <IFNAME> may be different by modules. It should be wlan0 or wlp1s0 usually. The name depends on the driver default when the module is probed.
nmcli device wifi connect <SSID> ifname <IFNAME> password <PASSWD>
nmcli
would report the connection result with following log:
Device 'wlan0' successfully activated with 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.
If everything works fine, you should be able to connect to the internet:
# Check if the board is actually connected to the internet.
ping www.google.com
Connect to a network via wpa_supplicant
Use this method only if you want to avoid using NetworkManager.
First, stop NetworkManager:
systemctl stop NetworkManager.service
To double check that NetworkManager has been stopped:
systemctl status NetworkManager.service
There should be a status log saying: Active: inactive (dead)
.
Now, configure /etc/wpa_supplicant.conf
with this command:
wpa_passphrase <SSID> <PASSWD> > /etc/wpa_supplicant.conf
And then verify the configuration file by running the following command:
cat /etc/wpa_supplicant.conf
The generated content of wpa_supplicant.conf
should be similar to this:
network={
ssid="<SSID>"
#psk="<PASSWD>"
psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
}
And we also have to configure the DNS server address:
echo "nameserver x.x.x.x " > /etc/resolv.conf
After setting resolv.conf
, restart systemd-resolved
service:
systemctl restart systemd-resolved.service
Finally, launch wpa_supplicant
with new configuration:
wpa_supplicant -B -i <IFNAME> -c /etc/wpa_supplicant.conf &
And you should now be able to connect to the internet:
ping www.google.com
Reference Boards
Wi-Fi on different platforms may have some platform-specific instructions or test results. For example, you will get different benchmark results on different platforms. Please find more details about difference of Wi-Fi on each platform: