Skip to content

UniFi DDNS

TrendingActive
willswire/unifi-ddns

A Cloudflare Worker that lets UniFi gateways update Cloudflare DNS records — dual-stack IPv4/IPv6 and multiple hostnames.

View on GitHub
Stars
1.3k
Forks
3.1k
Watchers
1.3k
Open issues
8

Overview

UniFi DDNS is a Cloudflare Worker that lets UniFi gateways (such as the UDM-Pro or USG) keep Cloudflare DNS records pointed at your current public IP. Your UniFi device calls the Worker using its built-in “custom” Dynamic DNS provider, and the Worker updates the A/AAAA records through the Cloudflare API.

Recent UniFi Network releases (9.1.92+) include native Cloudflare DDNS, but this Worker is still useful for older firmware and for features the native option lacks: updating multiple hostnames, dual-stack IPv4 + IPv6, and preserving each record’s proxy status.

Key Features

  • Works with UniFi’s built-in custom DDNS — no scripts on the router
  • IPv4 and IPv6 (A and AAAA records)
  • Multiple hostnames per update
  • Keeps the proxied/DNS-only setting of existing records
  • Runs on the Workers free tier

Getting Started

1. Deploy the Worker

Use the “Deploy to Cloudflare” button, or deploy with Wrangler:

npm i
wrangler login
wrangler deploy

Note the *.workers.dev hostname it gives you.

2. Create an API token

In the Cloudflare dashboard, create a user API token from the “Edit zone DNS” template and scope it to a single zone.

3. Configure UniFi OS

Under Settings → Internet → WAN → Dynamic DNS, add a new entry:

Field Value
Service custom
Hostname home.example.com
Username Your Cloudflare account email
Password The API token from step 2
Server your-worker.workers.dev/update?ip=%i&hostname=%h (without https://)

Use Cases

  • Keeping a home or office domain pointed at a dynamic residential IP
  • Dual-stack DDNS for homelabs with IPv6
  • Updating several hostnames from one UniFi gateway

License

MIT License.

Similar open-source projects, ranked by shared categories and tags.

All Network projects →