Using Cloudflare as a DDNS with UniFi (2025 update)
Configuring a Dynamic Domain Name Service (DDNS) on Ubiquiti's UniFi network manager is easy, if you use on of the configured providers that show up in the drop-down service.
I had recently upgraded to UnifiOS version 4.3.6, and finally Cloudflare exists as a selectable entry.
If you are running UDM version under version 3.x, use my original post to configure DDNS with Cloudflare: https://www.nodinrogers.com/post/2022-03-01-cloudflare-ddns-unifi/
These instructions assume you've already set Cloudflare to be your domain's nameservers.
If you need help with that, you probably shouldn't be using these instructions . . .
This was tested on UniFi OS UDM Pro 4.3.6
Cloudflare side setup
You will only need to do this once, and it isn't that difficult.
Create an API Token from Cloudflare
-
Under API Tokens, select Create Token
-
Select Use template for Edit zone DNS
- Under Zone Resources:
-
Include
-
Specific Zone
-
Select the domain we want to use for DDNS
-
This step is optional. If skipped, this API token will have permissions for all of your Cloudflare domains.
-
- Under Zone Resources:
-
Under TTL, select Start/End dates, or leave untouched for no expiration of these permissions.
-
Once generated, copy the API token and treat it like a password.
-
Testing the API token, given the
curl
command that Cloudflare provides:curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \ -H "Authorization: Bearer NS4ZC3Y6MTJD0IXPIM4QJ3L8BCF-BRDYX7JZ0VQW2M" \ -H "Content-Type:application/json" {"result":{"id":"amlf9mwd02v1t837dy3bhb1rlsuuhaw2c","status":"active"},"success":true,"errors":[],"messages":[{"code":10000,"message":"This API Token is valid and active","type":null}]}%
UDM setup and configuration
- In the UDM web interface, under Internet, select the interface connected to your ISP, which in my case, is Primary (WAN1).
- Under Advanced, click Manual, then Create New under Dynamic DNS, and select Cloudflare from the dropdown menu.
Example settings:
- Service: Cloudflare
- Hostname: example.nodinrogers.com
- Zone Name: nodinrogers.com
- API Token: I9O29EF3GQmyVP-1qp_Wj208Osd5q8svfQiRe5hG
The Hostname is the subdomain you want to create the DDNS for, and the Zone Name is the root domain name.
This is not my API key, just an example...
Using the above example would result in this:
Wait about 15 minutes (or so), then log into https://dash.cloudflare.com/ and check to see that your subdomain reflects the updated IP.