This script updates multiple Cloudflare DNS records with your current dynamic IP address. Access your home network remotely via a custom domain name without a static IP! Written in pure BASH.
- Multi-Record Support: Update multiple DNS records with a single script execution
- Reliable IP Detection: Uses multiple services to fetch your public IP
- Error Handling: Continues processing remaining records if one fails
- Notification Support: Sends status updates to Slack and/or Discord
git clone https://github.com/Warkstee/cloudflare-ddns-updater.git- Copy the template file and fill in your Cloudflare credentials:
cp cloudflare-template.sh cloudflare-ddns-updater.sh
chmod +x cloudflare-ddns-updater.sh
nano cloudflare-ddns-updater.sh- Set your Cloudflare credentials in the file:
auth_email="[email protected]" # The email used to login to Cloudflare
auth_method="token" # "global" for Global API Key or "token" for Scoped API Token
auth_key="your-api-token" # Your API Token or Global API Key
zone_identifier="your-zone-id" # Can be found in the Overview tab of your domain- Configure the domain records you want to update:
record_names=( # Array of records you want to be synced
"example.com"
"www.example.com"
"subdomain.example.com"
)This script is designed to be used with crontab. Specify the frequency of execution through crontab.
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday 7 is also Sunday on some systems)
# │ │ │ │ │ ┌───────────── command to issue
# │ │ │ │ │ │
# │ │ │ │ │ │
# * * * * * /bin/bash /path/to/cloudflare-ddns-updater.shFor example, to check every 5 minutes:
*/5 * * * * /bin/bash /path/to/cloudflare-ddns-updater.shThe script logs to your system's logger. You can view the logs using:
# View all system logs
sudo journalctl -e | grep "DDNS Updater"
# Or traditional log files
sudo cat /var/log/syslog | grep "DDNS Updater"The script supports sending notifications to Slack and Discord. To enable:
- For Slack, configure the
slackchannelandslackurivariables - For Discord, configure the
discordurivariable
- macOS Mojave version 10.14.6 (x86_64)
- AlmaLinux 9.3 (Linux kernel: 5.14.0 | x86_64)
- Debian Bullseye 11 (Linux kernel: 6.1.28 | aarch64)
- Proxmox VE 8.4.11 (Linux 6.8.12-13-pve)
This script is a modified version of K0p1-Git's cloudflare-ddns-updater, enhanced to support updating multiple DNS records simultaneously. The original script was created with reference from Keld Norman's video.