Configuring basic network connectivity
In this section, we are going to configure basic network connectivity using wpa_supplicant
.
Â
Getting ready
Besides having a terminal open, we need to remember a few concepts:
- Check whether
wpa_supplicant
is installed or not. - You should know the SSID and password.
- Remember that you have to run your program as a root user.
How to do it...
Create a script called wifi_conn.sh
and write the following code in it:
#!/bin/bash ifdown wlan0 rm /etc/network/interfaces touch /etc/network/interfaces echo 'auto lo' >> /etc/network/interfaces echo 'iface lo inet loopback' >> /etc/network/interfaces echo 'iface eth0 inet dhcp' >> /etc/network/interfaces echo 'allow-hotplug wlan0' >> /etc/network/interfaces echo 'iface wlan0 inet manual' >> /etc/network/interfaces echo 'wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf' >> /etc/network/interfaces echo 'iface default inet dhcp' >> /etc/network/interfaces rm /etc/wpa_supplicant/wpa_supplicant...