Configuring Wireless Network (WiFi)

This chapter explains how to configure a wireless network (WiFi) on a Linux system.
Install Required Software
First, install the necessary tools for wireless network configuration:
apt install wireless-tools wpasupplicant
apt install --reinstall wpasupplicant
Configure WiFi Connection
-
You might need to manually bring up or down the wireless interface:
ifup wlan0
ifdown wlan0 -
Configure the WiFi password and generate the configuration file:
wpa_passphrase YOUR_SSID YOUR_PASSWORD > /etc/wpa.conf
wpa_passphrase ANOTHER_SSID ANOTHER_PASSWORD >> /etc/wpa.conf(Replace
YOUR_SSIDandYOUR_PASSWORDwith your actual network credentials.) -
Connect to WiFi using the configuration file:
wpa_supplicant -i wlan0 -c /etc/wpa.conf -B
dhclient wlan0
Connect to WiFi Automatically at Boot
Edit the network configuration file to enable automatic connection at boot:
vim /etc/network/interfaces
Add the following lines:
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf
After completing the configuration, the system will automatically connect to the specified WiFi network on boot.