A Cloudflare Worker script that enables UniFi devices (e.g., UDM-Pro, USG) to dynamically update DNS A/AAAA records on Cloudflare.
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.
- Click the button above.
- Complete the deployment.
- Note the
*.workers.dev
route.
- Clone this repository.
- Install Wrangler CLI.
- Run:
wrangler login wrangler deploy
- Note the
*.workers.dev
route.
- Go to the Cloudflare Dashboard.
- Navigate to Profile > API Tokens
- Create a token using the Edit zone DNS template.
- Scope the token to one specific zone.
- Save the token securely.
- Log in to your UniFi OS Controller.
- Go to Settings > Internet > WAN > Dynamic DNS.
- Create New Dynamic DNS with the following information:
- Service:
custom
- Hostname:
subdomain.example.com
orexample.com
- Username: Cloudflare Account Email Address (e.g.,
[email protected]
) - Password: Cloudflare User API Token (not an Account API Token)
- Server:
<worker-name>.<worker-subdomain>.workers.dev/update?ip=%i&hostname=%h
(Omithttps://
)
- Service:
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. If the problem persists, please raise an issue here.