forcing re-resolve on reconnect

Post Reply
Paneologist
OpenVpn Newbie
Posts: 2
Joined: Tue May 23, 2017 9:09 am

forcing re-resolve on reconnect

Post by Paneologist » Tue May 23, 2017 9:35 am

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

Paneologist
OpenVpn Newbie
Posts: 2
Joined: Tue May 23, 2017 9:09 am

Re: forcing re-resolve on reconnect

Post by Paneologist » Mon Apr 09, 2018 9:54 pm

problem still present in current version?

is that too complicated :?: :?:

User avatar
ordex
OpenVPN Inc.
Posts: 290
Joined: Wed Dec 28, 2016 2:32 am

Re: forcing re-resolve on reconnect

Post by ordex » Wed Apr 18, 2018 3:28 am

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.

alalal
OpenVpn Newbie
Posts: 5
Joined: Sat Jul 06, 2019 11:15 am

Re: forcing re-resolve on reconnect

Post by alalal » Sat Jul 06, 2019 11:37 am

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!

300000
OpenVPN Power User
Posts: 57
Joined: Tue May 01, 2012 9:30 pm

Re: forcing re-resolve on reconnect

Post by 300000 » Sat Jul 06, 2019 4:03 pm

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

alalal
OpenVpn Newbie
Posts: 5
Joined: Sat Jul 06, 2019 11:15 am

Re: forcing re-resolve on reconnect

Post by alalal » Sat Jul 06, 2019 8:45 pm

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

Post Reply