Saturday, January 28, 2017

Temporarily switching Wi-Fi networks from the command line on a Raspberry Pi

I recently had a scenario with my Raspberry Pi (Zero, running Raspbian) where I needed to temporarily switch away from the primary Wi-Fi connection to another access point (to drive a camera) then reconnect to my original network. Turns out wpa_cli can do the trick:

The best thing about this approach is that it is non-persistent, so if it all goes horrible wrong you get your original networking configuration back upon reboot.