Setting raspberry pi WiFi
Once Pi is booted we need to set up the wifi so it will connect to wifi router
Second thing I did after starting up the Pi was I have configured the wifi. Following are the steps to configure the wifi on Pi3
Go to
root@raspberrypi:/etc/network# cd /etc/wpa_supplicant/ root@raspberrypi:/etc/wpa_supplicant# ls action_wpa.sh functions.sh ifupdown.sh wpa_supplicant.conf wpa_supplicant.conf.20160801 root@raspberrypi:/etc/wpa_supplicant# cat wpa_supplicant.conf network={ ssid="myssid" psk="password" }
Restart the raspberry
init 6
After reboot it will connect to wifi router.
Configure multiple wifi access points
if you have only one wifi then it will work but if you want to configure multiple wifi like for office, home then please follow process mentioned below
you need to add each network identifier (id_str=“identifier”) as mentioned below
Edit /etc/wpa_supplicant/wpa_supplicant.conf
file
country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="SSID1" psk="password_ssid1" id_str="home" } network={ ssid="SSID2" psk="password ssid2" id_str="hotel1" } network={ ssid="ssid3" psk="password ssid3" id_str="hotel2" }
Edit /etc/network/interfaces file and add following lines at the end of the file
iface home inet dhcp
iface hotel1 inet dhcp
iface hotel2 inet dhcp
your final file should look like below
# interfaces(5) file used by ifup(8) and ifdown(8) # Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d auto lo iface lo inet loopback iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf allow-hotplug wlan1 iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf iface home inet dhcp iface hotel1 inet dhcp iface hotel2 inet dhcp
Restart the Pi it will connect.