mholt / caddy-dynamicdns

Caddy app that keeps your DNS records (A/AAAA) pointed at itself.
Apache License 2.0
251 stars 25 forks source link

Doesn't Update Cloudflare dns #12

Closed gt2416 closed 3 years ago

gt2416 commented 3 years ago

When caddy first starts, it updates the dns ONLY if all the zones have different IP's to the current IP. If say I change an IP of 1 zone in cloudflare dashboard it does not update it. Also I kept my check interval at 1m, I can see in the logs it does try to check my current IP but never updates it UNLESS I restart caddy. Then it updates it ONCE and never again. So I have to keep restarting caddy when my ip changes. This is my caddy file

dynamic_dns {
                provider cloudflare {API KEY}
                domains {
                        mydomain.com @ test test1 test2
                }
                check_interval 1m
                ip_source simple_http https://icanhazip.com
                }
}

test.mydomain.com { 

My Logs:

{"level":"warn","ts":1632912662.507794,"logger":"dynamic_dns.ip_sources.simple_http","msg":"IPv6 lookup failed","endpoint":"https://icanhazip.com","error":"Get \"https://icanhazip.com\": dial tcp6 [2606:4700::6812:69c]:443: connect: no route to host"}
{"level":"warn","ts":1632912722.078304,"logger":"dynamic_dns.ip_sources.simple_http","msg":"IPv6 lookup failed","endpoint":"https://icanhazip.com","error":"Get \"https://icanhazip.com\": dial tcp6 [2606:4700::6812:69c]:443: connect: no route to host"}
{"level":"warn","ts":1632912782.1980016,"logger":"dynamic_dns.ip_sources.simple_http","msg":"IPv6 lookup failed","endpoint":"https://icanhazip.com","error":"Get \"https://icanhazip.com\": dial tcp6 [2606:4700::6812:79c]:443: connect: no route to host"}
{"level":"warn","ts":1632912842.0858293,"logger":"dynamic_dns.ip_sources.simple_http","msg":"IPv6 lookup failed","endpoint":"https://icanhazip.com","error":"Get \"https://icanhazip.com\": dial tcp6 [2606:4700::6812:69c]:443: connect: no route to host"}
{"level":"warn","ts":1632912902.5992603,"logger":"dynamic_dns.ip_sources.simple_http","msg":"IPv6 lookup failed","endpoint":"https://icanhazip.com","error":"Get \"https://icanhazip.com\": dial tcp6 [2606:4700::6812:69c]:443: connect: no route to host"}
mholt commented 3 years ago

I think you probably just don't have an IPv6-enabled network?

gt2416 commented 3 years ago

Nope don’t have ipv6. It’s a business environment, I’m not sure if that’s something I want to enable. Anyway I can use ipv4? Also when I first start caddy I get the same error but it does update my dns. It’s just the checking after that.

mholt commented 3 years ago

Yeah, you can use IPv4. This plugin tries both and not having an interface isn't a problem.

Updates only happen if your IP address changes.

gt2416 commented 3 years ago

Ah ok. So changing the ip on the cloudflare dashboard to check won’t trigger it right ? That’s how I was testing it.

mholt commented 3 years ago

Right, otherwise we'd have to do DNS lookups, and those are relative anyway. This plugin just checks your own IP address, and if that changes, then it updates the record. I don't know why you would change the record yourself when the plugin is managing that for you anyways. :thinking:

gt2416 commented 3 years ago

Literally just to test it. It’s a business environment so I needed to make sure it works, and my IP changes every few days or once a week, didn’t want to wait lol.