- 2024-07-02 - Added support for Unifi OS v4.x
- 2023-12-14 - Updated installation and uninstallation scripts for better user experience, flexibility, and removed support for v1.x firmware versions.
- 2023-02-10 - Major Update for UDM v2.x and v3.x
This project provides a script to set up a DDNS (Dynamic DNS) service using Cloudflare as the DNS provider on Ubiquiti's UDM devices. The script sets up a systemd service and timer to handle DDNS updates for your main internet IP address at regular intervals.
- Tested on UDM PRO with UDM OS v3.2.7
- UDM OS 2.x or 3.x
- ssh root access to the UDM
- Cloudflare API Toke
To create a CloudFlare API token for your DNS zone go to https://dash.cloudflare.com/profile/api-tokens and follow these steps:
- Click Create Token
- Select Create Custom Token
- Provide the token a name, for example,
example.com-dns-zone
- Grant the token the following permissions:
- Zone - DNS - Edit
- Set the zone resources to:
- Include - Specific Zone -
example.com
- Include - Specific Zone -
- Complete the wizard.
- Use the generated token at the
API_KEY
variable for the container
Run the following command to install the Cloudflare DDNS service as root on your UDM:
sudo curl -s -o install.sh https://raw.githubusercontent.com/fire1ce/UDM-Cloudflare-DDNS/main/install.sh
sudo chmod +x install.sh
sudo ./install.sh
This script will:
Determine the appropriate data directory. Download and install the DDNS script and configuration file. Set up a systemd service and timer to run the DDNS script at regular intervals (configurable by the user).
After installation, you can find and edit the configuration file typically located at /data/cloudflare-ddns/update-cloudflare-dns.conf
or /mnt/data/cloudflare-ddns/update-cloudflare-dns.conf
, depending on your UDM model and firmware version. Update this file with your Cloudflare details.
To uninstall the Cloudflare DDNS service, you will need to run an uninstallation script that:
Stops and disables the systemd service and timer. Removes the DDNS script, configuration files, and systemd files. Optionally removes log files, if generated by the service.
Run the following command to uninstall the Cloudflare DDNS service as root on your UDM:
sudo curl -s https://raw.githubusercontent.com/fire1ce/UDM-Cloudflare-DDNS/main/uninstall.sh | bash
This UDM-Cloudflare-DDNS project is based on the DDNS-Cloudflare-Bash script by the same author. It has been adapted and extended specifically for use with Ubiquiti's UDM devices.