How to make a vpn connection persistent on reboot
I have a workable vpn connection (NordVPN), which at present needs to be manually connected after each reboot. I would like to have the vpn automatically connected on startup. Is there a way to do this? Linux Mint 18 64bit, eth0 dhcp connection. Thanks
|
Are you using NetworkManager to manage your network settings? If so, a NetworkManager dispatcher script will do the job of starting the VPN as soon as the network is up. For example
http://askubuntu.com/questions/43465...etwork-manager |
Thanks for the reply. I've made some progress, but have stalled out now. I checked my connection names with
Code:
nmcli con show Code:
/etc/NetworkManager/dispatcher.d/vpn-up Code:
REQUIRED_CONNECTION_NAME="Ethernet connection dhcp" Code:
sudo chmod 755 /etc/NetworkManager/dispatcher.d/vpn-up Code:
Mar 25 15:15:02 x nm-dispatcher[1678]: Warning: password for 'vpn.secrets.password' not given in 'passwd-file' and nmcli cannot ask without '--ask' option. |
You may need to (re)define the connections as system-wide connections first, so that the credentials are stored in the connection config files themselves, as opposed to a password manager (for user-specific connection profiles).
|
Afraid I'm having no success now. I have the system to the point, that on reboot the eth0 will not connect automatically. But if I click on eth0 in the NetworkManager menu, both eth0 and the vpn both connect. Checking my /var/log/syslog file, I now have the following entries:
Code:
Mar 25 22:41:45 x NetworkManager[1234]: <info> [1490496105.5056] vpn-connection[XXXXXXXXXXXX,"uk19.nordvpn.com.tcp443",0]: VPN connection: (ConnectInteractive) reply received Code:
/home/x/.cert/nm-openvpn/uk19.nordvpn.com.tcp443-ca.pem Code:
/home/x/.cert/nm-openvpn/uk19.nordvpn.com.tcp443-tls-auth.pem Totally confused now. |
It's not clear to me why that would fail either, but hopefully someone else may know.
As an alternative to using the dispatcher script, perhaps you could just acivate the VPN when the desktop starts via an autostart script instead. http://askubuntu.com/questions/20968...nnamon-desktop |
BTW, you're not using an encrypted home folder by chance are you?
|
Yes ferrari, I am using an encrypted /home folder.
|
Quote:
|
Thanks ferrari. It was no problem to copy the
Code:
nm-openvpn Code:
/home/.cert/ Code:
/etc/openvpn2/ |
I'm not sure if I completely understand you. The VPN connection profile is stored in the /etc/NetworkManager/system-connections/ directory eg /etc/NetworkManager/system-connections//uk19.nordvpn.com.tcp443
It should contain the path to the .pem files. You can either edit the connection via NM or edit the file directly (as root). |
Thank you. I found the file. In
Code:
/etc/NetworkManager/system-connections/ |
Outstanding! Thank you so much ferrari for the guidance. The
Code:
/etc/NetworkManager/system-connections/uk19.nordvpn.com.tcp443_ Code:
/home/x/.cert/nm-openvpn/ Code:
/etc/openvpn2/nm-openvpn/ |
Glad to have been of help :)
|
Just a follow-up as an fyi... Almost 3 months later and not a single glitch ever. Perfect!
|
All times are GMT -5. The time now is 12:58 PM. |