tunix / digitalocean-dyndns

Dynamic DNS using DigitalOcean's DNS Services
76 stars 30 forks source link

Duplicate records created, still with the old IP #21

Open nicbou opened 3 years ago

nicbou commented 3 years ago

My IP address recently changed, and after 24 hours, the DNS record still pointed to the old IP. The logs show multiple (successful?) attempts to update the DNS records, but somehow it failed.

91.64.141.XXX) doesn't match current IP (91.64.142.XXX), sending data={"type": "A", "name": "XXXXX", "data": "91.64.142.XXX"} to url=https://api.digitalocean.com/v2/domains/XXXXXXX.com/records/120829XXX

I logged in to my Digitalocean dashboard, and saw 5-6 duplicate entries for that subdomain in the Networking tab, all showing the old IP.

nicbou commented 3 years ago

Could it be related to https://github.com/kubernetes-sigs/external-dns/issues/503 ?

tunix commented 3 years ago

Hi @nicbou ,

Unfortunetely I don't have any ideas. I haven't used this project inside k8s. Such an issue has not been reported before by any user. I guess this might be something with your system? Maybe you can share the logs?

nicbou commented 3 years ago

The issue has not reproduced itself. It's probably an issue on DigitalOcean's end.

nicbou commented 3 years ago

Hi @tunix, unfortunately I had the same problem again today. My ISP assigned me a new IP and my server went offline, but the DNS record was not updated. In digitalocean I see 6 duplicate records, all with the old address. In the docker logs, I see that it tried to update the IP, but it somehow didn't work:

dynamicdns_1       | Trying with ifconfig.co...
dynamicdns_1       | Found IP address 91.64.156.15
dynamicdns_1       | existing DNS record address (91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174) doesn't match current IP (91.64.156.15), sending data={"type": "A", "name": "home", "data": "91.64.156.15"} to url=https://api.digitalocean.com/v2/domains/nicolasbouliane.com/records/151343831
dynamicdns_1       | 158312602
dynamicdns_1       | 158640116
dynamicdns_1       | 158786875
dynamicdns_1       | 158792506
dynamicdns_1       | 159168836
dynamicdns_1       | 159907117
dynamicdns_1       | existing DNS record address (91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.142.174
dynamicdns_1       | 91.64.156.15) doesn't match current IP (91.64.156.15), sending data={"type": "A", "name": "timeline", "data": "91.64.156.15"} to url=https://api.digitalocean.com/v2/domains/nicolasbouliane.com/records/151343833
dynamicdns_1       | 158312609
dynamicdns_1       | 158640118
dynamicdns_1       | 158786878
dynamicdns_1       | 158792508
dynamicdns_1       | 159168837
dynamicdns_1       | 159907119
nicbou commented 3 years ago

This issue should not be closed. It's still happening.

nicbou commented 2 years ago

This happened once again.

  dynamicdns:
    image: tunix/digitalocean-dyndns
    environment:
      - DIGITALOCEAN_TOKEN
      - DOMAIN=nicolasbouliane.com
      - NAME=home;timeline

My IP changed this morning, and now I have 2 pages of duplicate DNS records, all of which point to the wrong IP address.

nicbou commented 2 years ago

I'm starting to see what could be wrong.

dynamicdns_1       | Trying with ifconfig.co...
dynamicdns_1       | Found IP address NEW_IP
dynamicdns_1       | existing DNS record address (OLD_IP
dynamicdns_1       | OLD_IP
[many more duplicate OLD_IP lines]
dynamicdns_1       | NEW_IP) doesn't match current IP (NEW_IP), sending data={"type": "A", "name": "home", "data": "91.65.119.67"} to url=https://api.digitalocean.com/v2/domains/nicolasbouliane.com/records/...
dynamicdns_1       | RECORD_ID
[many more RECORD_IDs]

So it looks like it compares a single IP to a bunch of different IPs, and the strings don't match.

tunix commented 2 years ago

Hi @nicbou ,

Have you tried passing REMOVE_DUPLICATES='true' as an environment variable? The script has the ability to remove duplicated DNS records but it's turned off by default. You should see a log message like below:

Unable to update '$sub' domain name as it has duplicate DNS records. Set REMOVE_DUPLICATES='true' to remove them.

Also, do you use the default sleep interval? (which is 5 mins) The script basically checks if the resolved IP address corresponds to the DNS record with the given subname and then creates or updates it.

According to your logs, record_id (at line 44) consists of many records per subdomain but I can't see how that's possible. Do you use the latest Docker image?

nicbou commented 2 years ago

I would have to check. This flag did not exist last time I used this project. I'm running the docker image with no version pinned, so it must not be that old.

In the end, I opted to write my own script, closely following yours.

Thanks for keeping an eye on that issue, even though you don't have much to work with.

Alper Kanat @.***> schrieb am Di., 1. Feb. 2022, 14:51:

Hi @nicbou https://github.com/nicbou ,

Have you tried passing REMOVE_DUPLICATES='true' as an environment variable? The script has the ability to remove duplicated DNS records but it's turned off by default. You should see a log message like below:

Unable to update '$sub' domain name as it has duplicate DNS records. Set REMOVE_DUPLICATES='true' to remove them.

Also, do you use the default sleep interval? (which is 5 mins) The script basically checks if the resolved IP address corresponds to the DNS record with the given subname and then creates or updates it.

According to your logs, record_id (at line 44) consists of many records per subdomain but I can't see how that's possible. Do you use the latest Docker image?

— Reply to this email directly, view it on GitHub https://github.com/tunix/digitalocean-dyndns/issues/21#issuecomment-1026865024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVWVIUBMNWZX3Y4WHG6ZDUY7QMXANCNFSM452PSXWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>