If you have multiple VPN connections (university/work), you'd appreciate if you could either could automatically connect to one of the VPNs or just use a few clicks to select one.
For me the way was installing NetworkManager on my Raspi4 having Raspian 10 (check with
lsb_release -a
), which required me to change config files.
Before you perform the following steps, make sure you have your WLAN password, you will need to enter it again in NetworkManager!
sudo apt install network-manager network-manager-gnome openvpn openvpn-systemd-resolved network-manager-openvpn network-manager-openvpn-gnome
sudo apt purge openresolv dhcpcd5
sudo vi /etc/nsswitch.conf
Instead of “vi” you can use “nano”.
hosts: files dns mdns4...
reboot
After reboot you will see a new icon appearing in the panel (where the clock is). Right click on the old WLAN icon - remove it; all networks will be managed my NetworkManager from now on.
Next set up your WLAN connection and import VPN connection from configuration. In NetworkManager press the plus icon scroll down to VPN, the last entry will be import.
For each connection you can set that it connects to a VPN automatically, just double click on the connection.