OpenVPN does not reliably reconnect after brief internet outage

This forum is for general conversation and user-user networking.
Post Reply
VADemon
OpenVpn Newbie
Posts: 1
Joined: Thu May 09, 2019 11:37 pm

OpenVPN does not reliably reconnect after brief internet outage

Post by VADemon » Fri May 10, 2019 12:07 am

It has occurred a couple times already that OpenVPN would not be able to reconnect back to the VPN server after an internet outage. It's unfortunate, because I often need remote access to my PC while away.

Log is flooded with:

Code: Select all

The requested name is valid, but no data of the requested type was found.
Searching this line led me to this blog entry pointing out it's a Windows network API error message about failed DNS lookup. No other relevant results at all though. Given my config, I believe this error is caused by OpenVPN client trying to resolve the server domain while using a disconnected VPN/tun adapter, so all requests are routed into a broken link.

OpenVPN client: 2.4.7/2.4.6
Windows 7 x64
My config:

Code: Select all

client
dev tun
proto udp
remote <DOMAIN> 1194
resolv-retry 300
persist-key
persist-tun
Has anyone had this problem before or knows a working solution?

If my clues are correct, there're 2 ways around:
Unsure: Make OpenVPN somehow bypass it's own routing via VPN tunnel when communicating with server, custom route for the VPN server IP like "route <server ip> 255.0.0.0 net_gateway". Since the VPN srv also has DNS srv set up and if the client's DNS is set to be this server, any DNS requests should route directly to the right IP for lookups?

My bet: Instead of connecting to VPN server through domain, write down the IP in config: "remote <IP> 1194". Alternatively, add the domain to /etc/hosts (bad when the server IP changes, but it's a personal server - all under control).

I will try the latter: add the domain to /etc/hosts and report on results months later when it happens again (or not).

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

Re: OpenVPN does not reliably reconnect after brief internet outage

Post by TinCanTech » Fri May 10, 2019 1:05 pm

VADemon wrote:
Fri May 10, 2019 12:07 am
persist-key
persist-tun
Try removing these from the client config.

Post Reply