Using OpenVPN with nmcli on Debian by ~glorifiedgluer

  1. Install openvpn and the NetworkManager package

       $ sudo apt install openvpn network-manager-openvpn
  2. Import the configuration file with nmcli (note that your connection will have the same name as the file, in this case, it will be called client)

       $ sudo nmcli connection import type openvpn file client.ovpn
  3. Append the following to /etc/NetworkManager/NetworkManager.conf

  4. Restart NetworkManager.

       $ sudo systemctl restart NetworkManager
  5. Enable this connection only for resources on its network and bring the connection up.

       $ sudo nmcli connection modify client ipv4.never-default true
       $ sudo nmcli connection up client