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!

  1. Installation of required packages (open console)
    sudo apt install network-manager network-manager-gnome openvpn openvpn-systemd-resolved network-manager-openvpn network-manager-openvpn-gnome
  2. Not 100% sure if you really need to perform this
    sudo apt purge openresolv dhcpcd5
  3. This one is essential!
    sudo vi /etc/nsswitch.conf

    Instead of “vi” you can use “nano”.

  4. Navigate with to the line beginning with “hosts” and move (or insert and delete) the entry “dns” to second place
    hosts: files dns mdns4...
  5. Restart computer

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.

  • Last modified: 2020/09/16 20:57