跳到正文

UniFi DDNS

热门趋势活跃
willswire/unifi-ddns

让 UniFi 网关更新 Cloudflare DNS 记录的 Cloudflare Worker——支持 IPv4/IPv6 双栈和多个主机名。

在 GitHub 查看
星标
1292
Fork
3147
关注
1292
未关闭 Issue
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.

按共同分类和标签排序的同类开源项目。

全部网络项目 →