leamas / ddupdate

Update DNS Data for Dynamic IP Addresses
MIT License
40 stars 28 forks source link

No way of updating v4 and v6 IPs at the same time #43

Closed ruedigerkupper closed 2 years ago

ruedigerkupper commented 4 years ago

Addresser default-web-ip will only update your IPv4 address, and default-web-ip6 will only update your IPv6 address – even if ip-version=all is in the config. There is no addresser that allows updating both at a time. In a typical dual-stack-setting your provider may change either one at any time, so there should be a way of checking and updating both.

Suggestion: Create addresser default-web-ip46which updates both. This may be done in a trivial way: Simply call default-web-ip and default-web-ip6 one after the other and combine the returned addresses into a single IpAddr object and return that.

leamas commented 3 years ago

Ack: this is a plain bug which needs to be addressed somehow.

However, the proposed approach will only work for default-web addressers. We need a more general mechanism which can use arbitrary addressers.

There is also the problem that the ipv4 and ipv6 address can be hosted at different services, with different caching.

Bottom line: we need to be able to run two independent services to handle this, taking us back to #25.

ruedigerkupper commented 3 years ago

I wasn't aware that #25 was related, thanks. Obviously, there's a "poor-man's-solution" for this: Since I already have a dedicated user solely for running the ddupdate service as a user unit, there is little to no overhead having a second dedicated user with another ddupdate config that updates the v6 address. Probably this is the way I'll go for my use case until there's a better solution.

leamas commented 2 years ago

Pushed some commits to devel which makes it possible to add multiple configuration sections. As I see it, it should now be possible to do something like

[myhost-ipv4]
ip-version = v4
loglevel = debug
address-plugin = default-web-ip
service-plugin = cloudflare.com
hostname = host.somewhere.net

[myhost-ipv6]
ip-version = v6
address-plugin = default-web6-ip
service-plugin =  some.service.com
hostname = host.somewhere.net
loglevel = info

... but that is certainly not to say I have tested it.

leamas commented 2 years ago

@ruedigerkupper : Ping? Can we close this with this as the solution?

ruedigerkupper commented 2 years ago

Yes, this looks like the right thing! I'll give it a try and report back!

ruedigerkupper commented 2 years ago

It works! Thank you!

ruedigerkupper commented 2 years ago

Hi @leamas, will there be an update for the ubuntu package that contains this fix?

atesin commented 1 year ago

hi.... i know some online check-ip services report both ip (v4 and v6) at once, with responses like

Detected IPv4 address : 181.43.109.76
Detected IPv6 address : 2001::f3d2:0:8401:23bc

however i can't see dual stack responses because i suspect my isp gives me only ipv4 addresses (edit: now that i think a little better, maybe that would mean the server will receive 2 ip packets, for v4 and v6 each, what i found unlikely :/ ) ... this is the most complete list of online ip detecting services i know = https://openwrt.org/docs/guide-user/services/ddns/client#detecting_wan_ip

i want to notice..... some years ago, my isp took the bad habit to redirect all my http traffic (port 80) about a week before my internet bill expires, to a captive portal page like "remember your internet bill will expire soon, pay early to avoid problems (i am aware, click here to continue browsing)" forcing me to click a button... that meant my ip-check and the whole further ddns system failed, losing sometimes remote access to my services

a way to get over these problems i found is to use an alterate http port (for example port 8245 for http://checkip.dyndns.com, or port 8080 for http://freedns.afraid.org/dynamic/check.php, as shown in the documentation i linked above)

it would be nice if ddupdate web ip detection plugin (that i believe uses checkip.dyndns.com underneath) would have this alternate port option to solve/avoid this problems if present... or maybe an option/plugin to use another url/port (like the google or amazon one?)