Skip to main content Question on Cloudflare DDNS : r/openwrt

Get the Reddit app

Scan this QR code to download the app now
Or check it out in the app stores
Go to openwrt

Question on Cloudflare DDNS

I am using https://openwrt.org/packages/pkgdata/ddns-scripts-cloudflare to dynamically update the DDNS - which is basically the A record I have configured in Cloudflare.

It works, but the way I have set it up, and I am not sure if I have done it right, causes the process to directly do DNS queries to check the current registered IP address (then update the cloudflare entry if necessary), which as a matter of course will never be correct (since doing a DNS query will always return the cloudflare proxied IP, while the actual registered IP (i.e. the A record) remains hidden behind the Cloudflare proxy), unless I deliberately turn the proxy off at Cloudflare, that is, which sort of defeats the purpose of using Cloudflare in the first place - even if it is only one subdomain that I have turned proxying off to make detection work.

Would like suggestions on keeping everything proxied while avoiding the detection process to return the proxied IP (thus triggering an update every single time). Or does everyone else turn off proxying also to make way for DDNS?

I mean, if it can utilize the Cloudflare API to update, can it not also use Cloudflare API to check what the current A record setting is?

Get a complimentary home charger and standard installation with every new Ford electric vehicle. That’s the Ford Power Promiseᵀᴹ.
Clickable image which will reveal the video player: Get a complimentary home charger and standard installation with every new Ford electric vehicle. That’s the Ford Power Promiseᵀᴹ.
Sort by:
Best
Open comment sort options

Not sure if its feasible to configure how you desire.

But there is a "workaround":

I use an unproxied A record subdomain for DDNS (ex: ddns.mydomain.com) and configure OpenWRT to use that record. Then you can point all other records (proxied CNAME subdomains) towards that same A record domain name.

In this example you would have 1 unproxied A record for DDNS validation purposes, and X amount of proxied actual subdomains for whatever you wish to use/host.

This is exactly what I am doing right now ! :)

But wondering if I can change that A record to proxied also.

Thanks for the suggestion !

More replies
Edited

I took some time just now to look at the underlying scripts of Openwrt's DDNS function (these scripts are all located in /usr/lib/ddns). It looks like if I write an extra script to detect the current A record, it can be integrated back to DDNS as the currently registered IP by going to Advanced Settings, changing the IP address source to "Script", then supplying the path of my script in the subsequent field.

So.... It now probably becomes a matter of writing a script to go straight to Cloudflare and extract the A record IP address.... At the end if it all works out, I can probably enable proxying for that A record once again (which I really want to do to make everything seem safer).

More replies