Raspberry Pi WIFI multiple networks

I have no idea why I had so many problems setting up a Raspberry Pi to connect to multiple networks in the past… but it is actually really simple. I needed my Raspberry Pi to connect to different wireless networks when I plugged it in a different location. (And just to be on the safe side, also connect to my mobile’s hotspot)

Setting up wpa_supplicant.conf

In the file wpa_supplicant.conf you need to specify each wireless network’s SSID, PSK (Wifi key/password) and an ID.

Open wpa_supplicant.conf

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf 

Add the following for each of your wireless networks, providing a ID for each:

    ssid="Wireless SSID Here"
    psk="Wireless Key/Password"

My Example:



Configure Network Interfaces

Open network interfaces

sudo nano /etc/network/interfaces

Add the following lines for each of your wireless networks

iface [NetworkID from WPA_Supplicant] inet dhcp


My Example




 It is pretty easy to add multi wireless networks. To make sure I can always access my pi headless I got it to connect to my mobile’s hotspot, this has been very useful as I have a SSH app on my phone and can connect directly to my Pi when I do not have a monitor or keyboard handy. You can also set a static ip for different networks.