The development has moved to Codeberg / 开发已迁移至 Codeberg:
https://codeberg.org/length/cf-ddns
Download the code
mkdir -p ~/scripts/cf-ddns
curl -L https://code.length.cc/cf-ddns.tar.gz | tar -xz -C ~/scripts/cf-ddns --strip-components=1Create Config
nano ~/scripts/cf-ddns/example.com.iniPaste Template
[auth]
dns_cloudflare_api_token = YOUR_TOKEN
[ipv4]
#'api' or 'local'
source = api
api_list =
https://icanhazip.com
https://ident.me
https://ifconfig.me/ip
https://checkip.amazonaws.com
domains =
a.example.com
b.example.com
[ipv6]
source = local
api_list =
domains =
a.example.com
b.example.com
Supports one .ini or multiple files (e.g., a.ini, b.ini).
The script processes all found .ini files.
Set permissions
chmod 600 ~/scripts/cf-ddns/*.iniGrant execution permission to the script
chmod +x ~/scripts/cf-ddns/cf-ddns.pyCreate the systemd user service directory
mkdir -p ~/.config/systemd/user/Create symbolic links (to register services with Systemd)
ln -sf ~/scripts/cf-ddns/cf-ddns.service ~/.config/systemd/user/cf-ddns.service
ln -sf ~/scripts/cf-ddns/cf-ddns.timer ~/.config/systemd/user/cf-ddns.timerReload the daemon and enable the timer immediately
systemctl --user daemon-reload
systemctl --user enable --now cf-ddns.timerEnable Linger (ensures the timer runs even after you log out of SSH)
sudo loginctl enable-linger $(whoami)If DNS updates fail, try clearing the cache files
rm /tmp/cf_zone_ids.json /tmp/cf_last_ip.cache