Automatically connect to VPN on boot
#1
I've got a Pi2 running Openelec 5.0.5, and an account with Private Internet Access.

I've set up my vpn (with PIA) using the instructions here (brianhornsby.com/blog/how-to-setup-your-vpn-client), which worked flawlessly.

I'm now trying to get it to automatically connect on boot.

I've searched a number of threats and using autostart.sh seems to be the easiest way. So I created an autostart.sh file and included the following code:

#!/bin/sh
openvpn /storage/Configfiles/vpn-config/france.ovpn &
sleep 5

But it's not connecting. I expect it's got something to do with me not supplying my credentials (which are in a pass.txt file), but I can't see how to do this.

Has anyone got any advice?

Thanks,
Reply
#2
Ok. I'm an idiot. Problem solved.

2 stupid things.

1 - I should not have used "/Configfiles/" but rather "/.config/" (I assumed it was the former because that's how the directory appeared to be named).
2 - it's case sensitive, and my file is called France.ovpn not france.ovpn.

All sorted now. Nothing to see here... Move along.

(thanks)
Reply
#3
I would like to do this as well. Could you be more specific in how to make an autostart.sh?

I already have a working vpn using the Brian addon.
Reply
#4
I followed the guide here:

http://wiki.openelec.tv/index.php/Autostart.sh

Running the command created the actual Autostart.sh file, which I could then add my own content to. I believe it needs to be created using that method as it needs to be an executable file (but I'm no expert!).
Reply
#5
(2015-03-10, 15:35)Legion79 Wrote: I followed the guide here:

http://wiki.openelec.tv/index.php/Autostart.sh

Running the command created the actual Autostart.sh file, which I could then add my own content to. I believe it needs to be created using that method as it needs to be an executable file (but I'm no expert!).
Thank you. I'll have a look at it tonight!
Reply
#6
I solved this by making the /storage/.config/autostart.sh calling conmanctl like this:
connmanctl connect vpn_domain_com_suffix_local &
(Okay, you got me: My domain is not "domain.com" and the DNS suffix is not really "suffix.local" but otherwise the line is as I have it)

The last argument is the second column in the line with your VPN connection when you run conmanctl services.
Reply

Logout Mark Read Team Forum Stats Members Help
Automatically connect to VPN on boot0