How to Automatically Re-enable VPN

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Advanced Networking
Author Message
halomaster
DD-WRT Novice


Joined: 16 Oct 2014
Posts: 9

PostPosted: Mon Jun 15, 2015 2:28    Post subject: How to Automatically Re-enable VPN Reply with quote
This is my setup
Netgear R7000
DD-WRT Kong build 27085
OpenVPN through router


Is it possible to automatically re-enable the VPN when it is shut down? Preferably through inputting a line from the command shell or adding a line in the "additional config" in the VPN page.


I have OpenVPN client enabled through the router. It is shown as "client: connected success" when I go to the OpenVPN status page. On ipchicken.com, it shows the VPN IP.

After every hour or so, the VPN would automatically shut down. On the OpenVPN status page, it would show "client: (blank)". I went to ipchicken.com and it showed my real IP.

To fix this, I would go to the VPN page then click on "apply settings". This would re-enable the VPN. The problem is I would have to do this manually each time, and I don't know exactly when the VPN goes down.

Another workaround is to block all internet traffic when the VPN is down, then enable the watchdog to ping an address. When the address is unreachable (due to the blocked traffic when VPN is down), the router automatically restarts, and the VPN is turned on again. My problem with this is I only want to re-enable the VPN, and I don't want to restart the router to do so each time.
Sponsor
netguru76
DD-WRT User


Joined: 14 Sep 2014
Posts: 52

PostPosted: Mon Jun 15, 2015 9:48    Post subject: Reply with quote
resolv-retry infinite

is in the config file?
halomaster
DD-WRT Novice


Joined: 16 Oct 2014
Posts: 9

PostPosted: Mon Jun 15, 2015 21:04    Post subject: Reply with quote
Yes, resolv-retry infinite was already there.

However, I modified the config and added "keepalive 10 60". So far, so good. I will know for sure after a few hours.


Update: That didn't work either. The VPN still disconnects, and will not automatically re-connect.

This is my config:
Code:
resolv-retry infinite
redirect-gateway def1
persist-key
persist-tun
nobind
ping-timer-rem
script-security 2
remote-cert-tls server
route-delay 5
verb 4
auth-nocache
keepalive 10 60
netguru76
DD-WRT User


Joined: 14 Sep 2014
Posts: 52

PostPosted: Tue Jun 16, 2015 11:06    Post subject: Reply with quote
this is my config, without using the gui ...
you may try this with your config ...
if there are problems, show your logfile (var/log/messages)

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=283685
halomaster
DD-WRT Novice


Joined: 16 Oct 2014
Posts: 9

PostPosted: Tue Jun 16, 2015 11:10    Post subject: Reply with quote
netguru76 wrote:
this is my config, without using the gui ...
you may try this with your config ...
if there are problems, show your logfile (var/log/messages)

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=283685


I think I found a solution.

My log showed this:
"DD-WRT daemon.err openvpn[31651]: ERROR: could not read Auth username from stdin"

I read that it's due to my enabling "auth-nocache". I deleted this line and re-connected the VPN. We'll see in a few hours if this works.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum