I asked this question at the DD-WRT forums, and even they seem to be stumped. So I will ask here.
My setup:
Netgear R7000
DD-WRT Kong build 27085
OpenVPN through router
Normally, when I connect to the VPN through my VPN provider's client app, the connection never drops on its own. In this scenario, I connect through the router.
Is it possible to automatically re-connect the VPN when it is disconnected? 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 disconnect. On the OpenVPN status page, it would show "client: (blank)". I went to ipchicken.com and it showed my real IP.
To work around this, I would go to the VPN page then click on "apply settings". This would re-connect the VPN. The problem is I would have to do this manually each time, and I don't know exactly when the VPN disconnects.
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 re-connects. My problem with this is I only want to re-connect the VPN, and I don't want to restart the router to do so each time.
This is my config:
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
other settings:
VPN server: disabled
VPN client: enabled
port: UDP, 443
tunnel device: TUN
encryption: AES 256-bit CBC
Hash: MD5
User Pass Authentication: enabled
TLS Cipher: None
LZO compression: Yes
NAT: Enabled
Firewall Protection: Enabled
Tunnel MTU setting: 1500 (default)
Tunndel UDP Fragment: 1300
Tunnel UDP MSS Fix: Enabled