DD-WRT OpenVPN - Auto reconnect

How to customize and extend your OpenVPN installation.
Post Reply
jpny
OpenVpn Newbie
Posts: 5
Joined: Wed Aug 02, 2017 1:32 pm

DD-WRT OpenVPN - Auto reconnect

Post by jpny » Wed Aug 02, 2017 2:38 pm

Im been using OpenVPN on my DD-WRT router for a few days now and the connection has remained stable. Im using policy based routing to only route specific IPs over the VPN (https://charleswilkinson.co.uk/2016/05/ ... nd-openvpn). This morning I noticed that my VPN connection was closed (the VPN status page of the router also showed state - client (blank) and the log was completely empty).

A simple reboot fixed the connection, but I am looking for a way to automate the re-connect. I don't think I can use the routers built in watch dog as I think it monitors the "main" connection not the PBR VPN connection.

as per the VPN companies setup instructions my config file has the following

Code: Select all

remote-cert-tls server
remote-random
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ping-timer-rem
reneg-sec 0
I think I can probably modify the ping-timer-rem command, or add one of the other ping commands, but I'm not really sure which one.

Can someone help me with this?
Also, any idea on how to test for the problem described above (unplugging just the modem doesn't simulate the problem, the router shows state - Client: RECONNECTING init_instance and when the modem come back online the VPN does re-establish itself)

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 2961
Joined: Fri Jun 03, 2016 1:17 pm

Re: DD-WRT OpenVPN - Auto reconnect

Post by TinCanTech » Wed Aug 02, 2017 3:43 pm

jpny wrote:as per the VPN companies setup instructions
The company that runs the server can disconnect you and close your openvpn remotely.

If they do so (and it sounds like they are), there is no option in openvpn to over ride this.

jpny
OpenVpn Newbie
Posts: 5
Joined: Wed Aug 02, 2017 1:32 pm

Re: DD-WRT OpenVPN - Auto reconnect

Post by jpny » Wed Aug 02, 2017 3:52 pm

is there no way to test if connection is closed and reboot?
or to have ping sent every x hours to keep alive?

jpny
OpenVpn Newbie
Posts: 5
Joined: Wed Aug 02, 2017 1:32 pm

Re: DD-WRT OpenVPN - Auto reconnect

Post by jpny » Thu Aug 03, 2017 11:31 am

I don't think it is the VPN company. in the past I have been connected for days at time, this morning I was disconnected when I woke up again and the router was rebooted just 7 hours ago.

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 2961
Joined: Fri Jun 03, 2016 1:17 pm

Re: DD-WRT OpenVPN - Auto reconnect

Post by TinCanTech » Thu Aug 03, 2017 6:01 pm

jpny wrote:I don't think it is the VPN company
Your logs will offer information ..

OpenVPN cannot spawn itself so your DD-WRT OS will have to monitor it.

jpny
OpenVpn Newbie
Posts: 5
Joined: Wed Aug 02, 2017 1:32 pm

Re: DD-WRT OpenVPN - Auto reconnect

Post by jpny » Thu Aug 03, 2017 9:18 pm

thanks. I just enabled the telnet log. the GUI log is empty after the disconnect. let me see what happens on the next disco

Post Reply