This repository provides a lightweight Dynamic DNS (DDNS) client for Cloudflare using a shell script and systemd timer. It checks your public IP periodically and updates your Cloudflare DNS A record if your IP changes.
- Automatically detects your public IP
- Updates your DNS A record via Cloudflare API
- Skips update if IP hasn't changed
- Logs activity via
systemdjournal (journalctl -t cf-ddns) - Fully automated installation with a single script
- A domain managed in Cloudflare
- Zone ID of the domain
- A DNS record (type A) already created
- A Cloudflare API Token with Zone DNS Edit permissions
jq,curl, andsystemd
Clone the repo and run:
sudo ./installAlternatively, without cloning:
curl -fsSL https://raw.githubusercontent.com/Edward-Ji/cf-ddns/main/install | sudo bashThe script will:
- Prompt for your Zone ID, API token, and DNS record name
- Validate your API token via the
/user/tokens/verifyendpoint - Automatically fetch the DNS Record ID
- Prompt for TTL, proxying, IP query domain, and update interval
- Save credentials and config to
/etc/cf-ddns/env - Install the
cf-ddnsscript and set up a systemd service + timer
To view logs:
journalctl -t cf-ddnsAll configuration values are stored in:
/etc/cf-ddns/env
This file is sourced by the systemd service. To update any value:
sudo nano /etc/cf-ddns/env
sudo systemctl restart cf-ddns.timerTo fully remove cf-ddns, run:
sudo ./uninstallOr if not cloned:
curl -fsSL https://raw.githubusercontent.com/Edward-Ji/cf-ddns/main/uninstall | sudo bashThis will:
- Stop and disable the timer
- Remove the systemd unit files
- Delete the updater script, environment file, and saved IP state