A Cloudflare Worker script that provides a UniFi-compatible DDNS API to dynamically update the IP address of a DNS A record.
UniFi Dream Machine Pro (UDM-Pro) or UniFi Security Gateway (USG) users may need to update Cloudflare domain name DNS records when their public IP address changes. UniFi does not natively support Cloudflare as a DDNS provider.
Ensure you have a Cloudflare account and your domain is configured to point to Cloudflare nameservers.
\*.workers.dev
route.wrangler deploy
.\*.workers.dev
route after creation.An API Token will be needed for each UniFi client performing DDNS updates. To create the token(s):
Tokens can now be created at the user level or account level
User token:
Account token: (Recommended)
Service
: Choose custom
or dyndns
.Hostname
: Full subdomain and hostname to update (e.g., subdomain.mydomain.com
or mydomain.com
for root domain).Username
: Domain name containing the record (e.g., mydomain.com
).Password
: Cloudflare API Token.Server
: Cloudflare Worker route <worker-name>.<worker-subdomain>.workers.dev/update?ip=%i&hostname=%h
.
https://
from the URL.To test the configuration and force an update on a UDM-Pro:
ps aux | grep inadyn
.inadyn -n -1 --force -f <config-path>
(e.g., inadyn -n -1 --force -f /run/ddns-eth4-inadyn.conf
)./var/log/messages
for related error messages.To test the configuration and force an update on a USG:
ls /run/ddclient/
(e.g.: /run/ddclient/ddclient_eth0.pid
)ddclient_eth0
)sudo ddclient -daemon=0 -verbose -noquiet -debug -file /etc/ddclient/<config>.conf
(e.g., sudo ddclient -daemon=0 -verbose -noquiet -debug -file /etc/ddclient/ddclient_eth0.conf
).SUCCESS
when the DNS record is set.sub.example.com
), create an A record manually in Cloudflare dashboard first.inadyn[2173778]: Failed resolving hostname https: Name or service not known
), remove https://
from the Server
field.