khayman
Participant
Post count: 35

Not too difficult. From command line:
sudo nano /etc/network/interfaces

Near the bottom add the following lines:

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
   wpa-ssid "whatever your ssid is"
   wpa-psk "your network password"

Ctrl-x to exit nano, it will ask you to save. Just hit Y and then enter to accept the filename. Reboot your pi using:
sudo reboot

What I also did that helps is tell raspberry pi to reconnect to my wifi in case I do something stupid like reboot my router. Here’s what I did.

sudo nano ./wifi_checker.sh

Inside good ol nano I used this script:

#!/bin/bash

if ! ifconfig wlan0 | grep -q "inet addr:" ; then
        ifup --force wlan0
        sleep 10
fi

Save and exit like you did before. Then:

sudo chmod +x ./wifi_checker.sh

Next you want to schedule that to run to check the status of your wifi connection. To that we go to crontab.

sudo crontab -e

Go to the bottom and enter the following line:

*/5 * * * * ~./wifi_checker.sh

Exit and save and you should be good to go.