You are not logged in.

#1 2014-10-19 20:36:48

boina
Member
From: Barcelona - Spain
Registered: 2011-06-05
Posts: 49

[SOLVED] Can't set VPN to autoconnect

I have a VPN service from Private Internet Access and works perfect with gnome-Network Manager but I have to manually connect at system start up and when waking up from suspend mode. It's not a big thing but I would like to auto-connect all the time. I have added my password to the config file in system connections as it says in the wiki for openvpn but it doesn't auto-connect and instead asks to enter the password again.

Is there an easy way to set auto connect?


best, jose.

Last edited by boina (2014-10-20 21:31:42)

Offline

#2 2014-10-19 20:41:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Can't set VPN to autoconnect

Bypass NM and just use a service file...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-10-19 20:48:38

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Can't set VPN to autoconnect

I actually singed up for this service just the other day.  The zip file that provides the ca.crt file also has a number of configs in it as well.  They are named *.ovpn, so you will have to rename them so that they are all *.conf, and place them in /etc/openvpn.  Otherwise you could go the other route and use drop-in service file modifications on the openvpn@.service file itself.

Offline

#4 2014-10-19 21:33:33

boina
Member
From: Barcelona - Spain
Registered: 2011-06-05
Posts: 49

Re: [SOLVED] Can't set VPN to autoconnect

Thank you so much guys but my knowledge on these kind of things is very limited close to nothing I guess. I could use some more guide on either option. I guess that in addition to copying these files (###.config) to /etc/openvpn I should do something else?

Thanks in advanced!!!!

Offline

#5 2014-10-19 21:42:53

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Can't set VPN to autoconnect


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2014-10-19 22:55:05

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] Can't set VPN to autoconnect

Edit your VPN file generated by NetworkManager (/etc/NetworkManager/system-connections/<name of VPN connection>) so it looks something like:

[connection]
id=<name of connection>
uuid=<uuid generated by NetworkManager>
type=vpn

[vpn]
service-type=org.freedesktop.NetworkManager.openvpn
connection-type=password
password-flags=0
remote=us-west.privateinternetaccess.com
comp-lzo=yes
reneg-seconds=0
username=<pia username>
remote-cert-tls=server
ca=/etc/openvpn/pia.crt

[vpn-secrets]
password=<secret password>

[ipv4]
method=auto

Then open the nm-connection-editor (Network Connections) and under the 'General' tab for the Wifi network you are attached to, there's a setting to 'Automatically connect to VPN when using this connection'. Pick your VPN connection, and you're all set!

Scott

Edit: for you CLI junkies that like using nmtui, that option doesn't exist there...only in the GUI nm-connection-editor

Last edited by firecat53 (2014-10-19 22:57:13)

Offline

#7 2014-10-20 20:32:55

boina
Member
From: Barcelona - Spain
Registered: 2011-06-05
Posts: 49

Re: [SOLVED] Can't set VPN to autoconnect

Thanks to you all, I would like the VPN to be active at all time and with roaming connections.
I'm almost there, I followed the wiki and I can connect running:

openvpn /etc/openvpn/US_East.config
(this works perfect)

The problem I have now is when trying to start this connection with systemctl.
Running this:

systemctl status openvpn@US_East.service

The output is the following:

● openvpn@US_East.service - OpenVPN connection to US_East
   Loaded: loaded (/usr/lib/systemd/system/openvpn@.service; enabled)
   Active: failed (Result: exit-code) since lun 2014-10-20 22:15:17 CEST; 2min 43s ago
  Process: 7149 ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i --writepid /run/openvpn@%i.pid (code=exited, status=1/FAILURE)

oct 20 22:15:17  openvpn[7149]: Options error: In [CMD-LINE]:1: Error opening configuration...conf
oct 20 22:15:17  openvpn[7149]: Use --help for more information.
oct 20 22:15:17  systemd[1]: openvpn@US_East.service: control process exited, code=exited status=1
oct 20 22:15:17  systemd[1]: Failed to start OpenVPN connection to US_East.
oct 20 22:15:17  systemd[1]: Unit openvpn@US_East.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full

There seems to be a failure when launching openvpn but I don't know what could it be.
Any possible help?
Thanks again.

Offline

#8 2014-10-20 21:08:26

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Can't set VPN to autoconnect

The error message explains it: the service file expects the config to end in .conf


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2014-10-20 21:31:15

boina
Member
From: Barcelona - Spain
Registered: 2011-06-05
Posts: 49

Re: [SOLVED] Can't set VPN to autoconnect

Baaa!! what a dumb.....
Working perfectly now!!!
Thank you all
I love arch but I don't know much about computing.
Thanks to all arch forums!!! The best!!!

Offline

Board footer

Powered by FluxBB