Provide a UniFi-compatible DDNS API, making it easy for you to dynamically update the IP address of Cloudflare DNS A records on UniFi OS.
The official DDNS service provided by UniFi does not support Cloudflare. Prior to this, there was a highly useful version based on Workers. This project has been reconstructed in Go based on willswire/unifi-ddns, making it convenient for you to use with Docker or directly run the Binary.
If you want to deploy using Cloudflare Workers, I highly recommend checking out this repository willswire/unifi-ddns.
mkdir unifi-cloudflare-ddns && cd unifi-cloudflare-ddns
wget -O compose.yaml https://github.com/missuo/unifi-cloudflare-ddns/raw/main/compose.yaml
docker compose up -d
docker run -d --name unifi-cloudflare-ddns -p 9909:9909 missuo/unifi-cloudflare-ddns
The example uses the screen command to run the binary in the background.
apt install wget screen -y
wget -O unifi-cloudflare-ddns https://github.com/missuo/unifi-cloudflare-ddns/releases/download/v1.0.3/unifi-cloudflare-ddns-linux-amd64
chmod +x unifi-cloudflare-ddns
screen -S unifi-cloudflare-ddns
./unifi-cloudflare-ddns
- Go to Cloudflare Dashboard
- Go to API Tokens -> Create Token
- Select Edit Zone DNS
- Select Permissions -> Zone -> DNS -> Edit
- Select Zone Resources -> Include -> Specific Zone -> Your Domain Zone
- Click Continue to summary
- Click Create Token
- Copy the token
- Log in to your UniFi OS Controller.
- Navigate to Settings > Internet > WAN and scroll down to Dynamic DNS.
- Click Create New Dynamic DNS and provide:
Service
: Choosecustom
ordyndns
.Hostname
: Full subdomain and hostname to update (e.g.,subdomain.mydomain.com
ormydomain.com
for root domain).Username
: Domain name containing the record (e.g.,mydomain.com
).Password
: Cloudflare API Token.Server
: Cloudflare Worker routeYOUR_IP:9909/update?ip=%i&hostname=%h
.- For older UniFi devices, omit the URL path.
- Remove
https://
from the URL.