I have searched these forums and found 2 posts that describe the same problem but maybe with not enough depth so I hope this clearly explains it and hopefully an option can be developed for these cases.
- Server runs on a private network with all port forwarding and connections working properly.
- DynDNS points to the Dynamic IP which then gets forwarded internally.
- NAT loopback\hairpin exists so that if a "vpn.dyndns.com" is used it is directed to the WAN IP of the router.
- I have my ISP's router which gets a public dynamic IP and my router that I use it's WAN IP as my loopback target (Double NAT)
- My router does not face the internet directly and I do not have an option to bridge the connection with my ISP router
- From both inside the network or outside the connections work normally.
- An Always On VPN client would want to stay connected to the home while roaming out of the house and back.
Where it fails
When outside the home network, the dyndns has resolved my public IP.
When I come home and connect to my wifi OpenVPN tries to reconnect but with my external public IP address that it has resolved vs my WAN IP.
Note: the loopback is to the WAN IP and not to my ISP router's IP as the latter is dynamic so I cannot make it static.
(If i had a static IP I wouldn't need the dyndns and I would have had this as my target IP from the beginning)
When home, it has already resolved the Nat loopback IP (WAN IP) and when i leave the house and it connects on 4G it is still trying to reach that WAN IP.
Basically anyone running it on their home network using a dyndns service and switching between home and data (coming or leaving the house).
Manually disconnect and reconnect solves this but it has to be done every time and is not seamless.
I understand this was by design, but a useful option could be to re-resolve the DNS with any (or all) of these options:
1- Change in network detected
2- On reconnect
3- On reconnect after x failed attempts
I hope this was clear enough and detailed. Let me know if more is needed.
Related links I found: