Autoconnect to NetworkManager VPN on systemd based system

Here is small post with instructions how to setup auto connect to VPN. Of course you can probably figure out all this yourself, but what if you are lazy?

Following was tested on OpenSuse 13.1.




nmcli con status id $CONN > /dev/null

if [[ $rc != 0 ]] ; then
    nmcli con up id $CONN
    sleep 5 # optional wait time

NetworkManager: ```text journalctl -b -u Dispatcher failed: (32) Unit dbus-org.freedesktop.nm-dispatcher.service failed to load: No such file or directory.

* If you see line about dispatcher service - enable it manually by running `systemctl enable NetworkManager-dispatcher.service`.
* By default NetworkManager will store VPN password in keyring, to start VPN without keyring dependencies update VPN connection configuration with following changes:


And now everything should work like a charm!