Ask / Submit

Autoconnect to vpn when network goes up

asked 2015-12-06 20:02:30 +0300

Federico gravatar image

updated 2016-08-17 10:55:26 +0300

jiit gravatar image

Has someone managed to configure openvpn on a Jolla phone so that a VPN connection is started whenever the wifi network goes online?

I have tried Securefishnet, but it doesn't reconnect to the VPN if the network goes down and then up again. There is a reference on about the possibility of doing it using the DBus Connman API, but that's all I could find.


edit retag flag offensive close delete

2 Answers

Sort by » oldest newest most voted

answered 2015-12-06 23:31:09 +0300

utkiek gravatar image

updated 2015-12-06 23:42:45 +0300

I have a systemd service in /etc/systemd/system/

You need root access and you must able to use the terminal. OK? Let's start; Create a file myopenvpnhost.service with "myopenvpnhost" is the name of your openvpn configuration found in /etc/openvpn. Type in this new myopenvpnhost.service:

Description=OpenVPN Robust And Highly Flexible Tunneling Application On MyOpenVPNHost

ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/ --cd /etc/openvpn/ --config /etc/openvpn/myopenvpnhost.conf 
ExecStop=killall -9 openvpn


In myopenvpnhost.conf is your openvpn configuration. Now try this systemd service:

systemctl start myopenvpnhost.service 

systemctl status myopenvpnhost.service

Check the log, then stop the test with

systemctl stop myopenvpnhost.service

If all ok type

systemctl enable myopenvpnhost.service

Then openvpn started every time the network started. Works by me since February 2014. [edit layout]

edit flag offensive delete publish link more



Hi. I would like to start it when I'm outdoors(i.e: Mobile Data) and stop it when I'm at home with Wi-Fi. Do you think it is possible? Thanks Regards.

Pasko ( 2016-09-18 13:23:45 +0300 )edit

answered 2016-09-18 22:43:07 +0300

DarkTuring gravatar image

I am using securefishnet and it can reconnect fine, the problem is when the radio switches between wifi to mobile data. It then cannot connect, is there a patch for that or is the solution above ok for sailfish

edit flag offensive delete publish link more


I would also like to use VPN via mobile data ;-) Unfortunatly many mobile provider prohibit VPN connections because they like to track you since it's their business ;-( Using VPN in most Wifi works luckily.

Marti Masa K ( 2016-11-19 20:15:27 +0300 )edit

@Marti Masa K have since figured it out works and wifi, but every time radio switches disable DNS queries to VPN , this doesn't work for browsing the web otherwise and most apps dont like that routing either.

DarkTuring ( 2016-11-20 06:21:09 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2015-12-06 20:02:30 +0300

Seen: 875 times

Last updated: Sep 18 '16