https://github.com/willswire/unifi-ddns
Cloudflare DDNS (Dynamic DNS) support for UniFi OS
https://github.com/willswire/unifi-ddns
cloudflare cloudflare-workers ddns ddns-updater dns ubiquiti unifi unifi-controller
Last synced: 3 days ago
JSON representation
Cloudflare DDNS (Dynamic DNS) support for UniFi OS
- Host: GitHub
- URL: https://github.com/willswire/unifi-ddns
- Owner: willswire
- License: mit
- Created: 2022-02-02T21:21:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T16:06:51.000Z (about 1 month ago)
- Last Synced: 2025-04-27T20:05:25.945Z (19 days ago)
- Topics: cloudflare, cloudflare-workers, ddns, ddns-updater, dns, ubiquiti, unifi, unifi-controller
- Language: TypeScript
- Homepage:
- Size: 373 KB
- Stars: 1,168
- Watchers: 23
- Forks: 3,568
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# ๐ฉ๏ธ Cloudflare DDNS for UniFi OS
[](https://github.com/willswire/unifi-ddns/actions/workflows/github-code-scanning/codeql)
[](https://github.com/willswire/unifi-ddns/actions/workflows/coverage.yml)
[](https://github.com/willswire/unifi-ddns/actions/workflows/dependabot/dependabot-updates)
[](https://github.com/willswire/unifi-ddns/actions/workflows/deploy.yml)A Cloudflare Worker script that enables UniFi devices (e.g., UDM-Pro, USG) to dynamically update DNS A/AAAA records on Cloudflare.
## Why Use This?
UniFi devices do not natively support Cloudflare as a DDNS provider. This script bridges that gap, allowing your UniFi device to keep your DNS records updated with your public IP address.
## ๐ **Setup Overview**
### 1. **Deploy the Cloudflare Worker**
#### **Option 1: Click to Deploy**
[](https://deploy.workers.cloudflare.com/?url=https://github.com/willswire/unifi-ddns)1. Click the button above.
2. Complete the deployment.
3. Note the `*.workers.dev` route.#### **Option 2: Deploy with Wrangler CLI**
1. Clone this repository.
2. Install [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/).
3. Run:
```sh
npm i
wrangler login
wrangler deploy
```
4. Note the `*.workers.dev` route.### 2. **Generate a Cloudflare API Token**
1. Go to the [Cloudflare Dashboard](https://dash.cloudflare.com/).
2. Navigate to **Profile > API Tokens**
3. Create a token using the **Edit zone DNS** template.
4. Scope the token to **one** specific zone.
5. Save the token securely.### 3. **Configure UniFi OS**
1. Log in to your [UniFi OS Controller](https://unifi.ui.com/).
2. Go to **Settings > Internet > WAN > Dynamic DNS**.
3. Create New Dynamic DNS with the following information:
- **Service:** `custom`
- **Hostname:** `subdomain.example.com` or `example.com`
- **Username:** Cloudflare Account Email Address (e.g., `[email protected]`)
- **Password:** Cloudflare User API Token *(not an Account API Token)*
- **Server:** `..workers.dev/update?ip=%i&hostname=%h`
*(Omit `https://`)*## ๐ ๏ธ **Testing & Troubleshooting**
Using this script with various Ubiquiti devices and different UniFi software versions can introduce unique challenges. If you encounter issues, start by checking the FAQ in `/docs/faq.md`. If you donโt find a solution, you can ask a question on the [discussions page](https://github.com/willswire/unifi-ddns/discussions/new?category=q-a). If the problem persists, please raise an issue [here](https://github.com/willswire/unifi-ddns/issues).