
Scan wifi to check if your Raspberry detects available wifi
iwlist scan | grep <SSID>
If you see your wifi SSID in the out of the command above. Your wifi dongle is fine, and RPi is seeing your wifi.
Open raspi-config
sudo raspi-config
- Select
System Options/Wireless LAN - Select country
- Input
SSIDandpassword - Select
OKandFinish - If RPi asks you to reboot, DON’T.
There is case which raspi-config tell you that it
Could not communicate with wpa_supplicant
This happens quite often with RPi 2b (my model). One workaround is run:
sudo wpa_supplicant -iwlan0 -D wext -c/etc/wpa_supplicant/wpa_supplicant.conf -B
dhclient wlan0
and then repeat the raspi-config procedure above.
Auto connect to wifi after rebooting
To automatically connect to your AP after restart edit the wlan0 interface on your /etc/network/interfaces as follow:
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
sudo reboot
ref: https://unix.stackexchange.com/a/400113
May wifi be with you!