Multiple WiFi network connections on Rapspberry Pi 5

This post was intended to be an answer to this question. But given that I’m a new Raspberry Pi’s StackExchange user and I don’t have enough karma, I cannot post my answers yet, hence a post in my own blog.

Problem statement: I want to have multiple networks to connect my Raspberry Pi 5 device to, e.g. a WiFi connection at home and another WiFi connection at work. Previously, all the WiFI network configuration used to be done with the wpa_applicant alongs with many other network-related tools. Now, it seems, NetworkManager and its plugins took over many Linux distributions, including Raspberry Pi OS.

According to the changelog, in September 2022 and later in December 2023 NetworkManager started to be used as a high-level interface for all the network configuration on Raspberry Pi OS. So, as of January 2024 for Raspberry Pi 5 under Debian 12.4 Bookwork (Raspberry Pi OS) this is how one can have multiple WiFi connection profiles set up.

Headless set-up

  1. Connect to your device and become a root user
$ ssh user@raspberrypi.local
$ sudo -s
  1. Find all the WiFi networks available and network devices
$ nmcli dev wifi
$ nmcli dev

note the SSID (your network ID) and the Device name (e.g. wlan0 of type wifi).

  1. Run a NetworkManager config tool with the text-based interface
$ nmtui

Edit connection -> Add -> WiFi.

  1. Add a new connection profile:
  • profile name
  • SSID from the step 2
  • Security (usually WPA & WPA2 Personal for the home WiFi routers + password)
  • Other settings if needed (e.g. if no DHCP is used)
  • <OK>
  1. Restart the NetworkManager service
$ systemctl restart NetworkManager
  1. To switch between the connection profiles manually
$ nmtui

Activate a connection -> Choose a profile needed

The same can be done via the CLI tool

$ nmcli connection down 'profile1'
$ nmcli connection up 'profile2'

Beware not to deactivate your only active connection! Otherwise you may found your ssh session hang. You’ll need to restart the device (if no other connections exist) and reconnect in this case.


I haven’t used Debian Bookworm with the GNOME desktop environment, but I guess it uses nm-connection-manager as a GUI alternative to nmcli and nmtui and is a part of the network-manager-gnome package.

More details on NetworkManager: