Configuring Wi-Fi Connectivity
Overview
This guide explains how to configure and connect a Wi-Fi network on a device running Clea OS.
The procedure uses wpa_supplicant, a standard Linux utility for managing wireless network authentication and encryption.
Once configured, the device can connect automatically to the selected Wi-Fi network at startup or on demand.
Requirements
Before starting, ensure that:
- The device has a supported Wi-Fi interface (for example,
wlan0). - The wireless driver is loaded and visible through
ip link show. - You have the SSID and password of the target Wi-Fi network.
All commands in this guide are executed on the target device shell, represented by the # prompt.
Do not copy and paste the # to execute commmands.
1. Generate the Configuration File
Create a WPA configuration file using the wpa_passphrase command.
Replace MySSID and MyPassword with your actual Wi-Fi credentials:
# wpa_passphrase MySSID MyPassword > /etc/wpa_supplicant.conf
This command generates a valid configuration file at /etc/wpa_supplicant.conf, including the SSID, password, and corresponding encrypted key.
You can verify the content with:
# cat /etc/wpa_supplicant.conf
Do not share or expose the wpa_supplicant.conf file, as it contains sensitive credentials.
2. Start the Wi-Fi Connection
Use the following command to start the Wi-Fi connection in the background:
# wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
- The option
-Bruns the process in the background. - The option
-ispecifies the network interface (typicallywlan0). - The option
-cpoints to the configuration file created earlier.
To verify that wpa_supplicant is running, execute:
# ps | grep wpa_supplicant
If the command returns a process ID, the service is active.
3. Request an IP Address
Once wpa_supplicant has associated with the access point, request an IP address using the DHCP client udhcpc:
# udhcpc -i wlan0
If the connection is successful, you should see messages indicating that an IP address has been assigned.
4. Verify the Connection
Check that the wireless interface has received an IP address:
# ifconfig wlan0
or equivalently:
# ip addr show wlan0
Test the network connection by pinging an external host:
# ping -c 4 8.8.8.8
If replies are received, the Wi-Fi connection is active.
Troubleshooting
If the connection fails, review the following checks.
Check Wi-Fi Interface Availability
Ensure that the interface exists and is not blocked:
# ip link show wlan0
If the interface is missing, verify that your Wi-Fi driver is correctly loaded.
Inspect Logs
Check for errors or authentication issues using journalctl:
# journalctl -u wpa_supplicant
You can also view live logs while reconnecting:
# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -d
Restart the Connection
If the interface was previously connected, try restarting the service:
# pkill wpa_supplicant
# wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
Then request a new IP address again:
# udhcpc -i wlan0
Tips for Persistent Configuration
To make the Wi-Fi connection persistent across reboots:
- Store the
wpa_supplicant.conffile permanently under/etc/. - Add the
wpa_supplicantandudhcpccommands to a startup script (for example,/etc/rc.local) or create a dedicatedsystemdservice. - Ensure that the network interface is not managed by another network manager that could override the connection.
Summary
You have successfully configured a Wi-Fi connection using wpa_supplicant on a Clea OS device.
The basic workflow includes generating a secure configuration file, starting the connection, obtaining an IP address, and verifying connectivity.
Once verified, the configuration can be automated or managed through scripts for production systems.
By following these steps, Clea OS devices can connect reliably to wireless networks and maintain connectivity across power cycles or reboots.