7

Hi i bought vpn access form a vpn provider, i got a bunch of .ovpn files.

How can i get openvpn to startup one of these .opvn files under start/boot up?

I would like to, not have to run openvpn --config VPNservername.ovpn every time i have to do a reboot. I'm running ubuntu 12.04 server.

I have installed openvpn

13

When you have installed openvpn from the repo, everything is already prepared for you.

Place the whatever.conf file in /etc/openvpn/ and a daemon will be started for it at boot.

Edit

Please note that *.opvn will not work, *.conf will.

2
  • @staR I don't know if that was really necessary. But anyway, please try to copy whatever.ovpn to /etc/openvpn/. You'll have to have root rights for this and rename it to whatever.conf. Good luck! – Klaus-Dieter Warzecha Feb 25 '14 at 22:56
  • My pleasure :-) – Klaus-Dieter Warzecha Feb 26 '14 at 0:04
2

Note, that /etc/default/openvpn file contain AUTOSTART option. You can add there all your configs without .conf at the end you want to autostart. But don't forget to do:

systemctl daemon-reload

after editing it.

4
  • 1
    This is irrelevant to this question as it was asked a long time ago and the OP is running Ubuntu 12.04. And it dosen't seem the OP is going to accept - he hasn't been on for 3 months. – fosslinux Jul 22 '16 at 5:09
  • 5
    Nevertheless, I believe it could help people, who's looking for the answers with similar problems. – AstraSerg Jul 24 '16 at 6:39
  • @ubashu I don't think this is irrelevant. Answers should change based on newer versions of software. This is the top result for me when I search. – Allison May 30 '17 at 5:17
  • This helped me a lot today and should be upvoted, thanks for the answer @AstraSerg – TheCatWhisperer Oct 28 '18 at 20:14
0

If on ubuntu server: go to rc.local. vi /etc/rc.local add the following line openvpn --config /your/path/file.ovpn save and reboot.

1
  • wouldn't that block the rest of the /etc/rc.local script from running? – ozma Jul 2 '17 at 11:52
0

Put the keys, certificates, and client configuration file in the proper folders...

/etc/openvpn/ca.crt
/etc/openvpn/client/client0.crt
/etc/openvpn/client/client0.key
/etc/openvpn/client/ta.key
/etc/openvpn/client/client0.conf

Enable OpenVPN client service to start at boot and start it...

systemctl enable openvpn-client@client0
systemctl start openvpn-client@client0

NOTE: In the example "client0" is the name of the configuration chosen!

TIP: Client configuration example...

client
remote <OPENVPN_SERVER_IP_OR_NAME> 1194
dev tun
proto udp
resolv-retry infinite
nobind
persist-key
persist-tun
verb 3
cipher AES-256-CBC
keepalive 10 120
compress lz4-v2
auth-nocache
remote-cert-tls server

ca /etc/openvpn/ca.crt
cert /etc/openvpn/client/client0.crt
key /etc/openvpn/client/client0.key
tls-auth /etc/openvpn/client/ta.key 1

Thanks! =D

0

I had to move the ca.crt into the /etc/openvpn/client directory and renamed .ovpn to .conf. Then it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.