Page 1 of 1

forcing re-resolve on reconnect

Posted: Tue May 23, 2017 9:35 am
by Paneologist
Hi all,
how can I force OpenVPN connect to resolve the hostname again, when reconnecting (e.g. changed network)?
(If I found where OpenVPN Connects logfiles are saved I would have attached - didn't find out how to get the familiar verbose output)

It keeps trying to connect to the configured servers in an endless loop:
EVENT: RECONNECTING
Contacting OLDIPADDRES via UDP
EVENT: WAIT
Connecting to [hostname] (OLDIPADDRESS) via UDPv4
Contacting OLDIPADDRES via UDP
but it never re-resolves the IP for the hostname, the way it does if I disconnect/connect:
beginning with:
EVENT: RESOLVE
Contacting NEWIPADDRESS via UDP
I need this, because on a local network DNS the configured hostnames are being resolved to another address, public open world IP is not routable in the local network for safety issues. So when I switch from mobile data (using the open world IP) to Wi-Fi (with the local IP) the hostname must be re-resolved.

It was why I switched from openVPN for Android to OpenVPN Connect, because openVPN for Android seems to have configured persist-remote-ip at compile time - or I did not find out how to disable that behaviour.

Thank you all for any hints :)

Paul

Re: forcing re-resolve on reconnect

Posted: Mon Apr 09, 2018 9:54 pm
by Paneologist
problem still present in current version?

is that too complicated :?: :?:

Re: forcing re-resolve on reconnect

Posted: Wed Apr 18, 2018 3:28 am
by ordex
this is such by design. the openvpn app may not have access to a working DNS during a reconnection, therefore it caches all the IP at the beginning.
However, I do understand your particular use case.

Re: forcing re-resolve on reconnect

Posted: Sat Jul 06, 2019 11:37 am
by alalal
Hi Ordex, I really hope we can see this as a feature in the near future.

I've also outlined a detailed post that describes this as well to make it easier for others to find it.
viewtopic.php?f=33&t=28547

Thank you for your help!

Re: forcing re-resolve on reconnect

Posted: Sat Jul 06, 2019 4:03 pm
by 300000
add this in your client openvpn config and forget connect /disconnect , it it do automatic for you whenever you charge network , my android phone just connect all the time no matter wifi or 4g network.


remap-usr1 SIGHUP
resolv-retry infinite

Re: forcing re-resolve on reconnect

Posted: Sat Jul 06, 2019 8:45 pm
by alalal
Thanks again for your help...i detailed the final solution in my original thread since this didn't solve the problem.

Keeping it here so others could find as well:
viewtopic.php?f=33&t=28547&p=85976#p85976