A robust Dynamic DNS (DDNS) updater for Cloudflare that automatically updates your DNS records when your public IP address changes. Available in both Windows (PowerShell) and Linux (Python) implementations.
- Automatic IP Detection: Monitors your public IP and updates DNS records when it changes
- Multi-Platform Support: Native implementations for both Windows and Linux
- Reliable Updates: Multiple IP detection services with automatic fallback
- Secure: Encrypted credential storage and minimal permission requirements
- 24/7 Operation: Runs continuously as a background service
- Comprehensive Logging: Detailed logs for troubleshooting and monitoring
- Easy Configuration: Simple JSON-based configuration
# Run with administrator privileges
.\Update-CloudflareDDNS.ps1
# Install as scheduled task
.\Update-CloudflareDDNS.ps1 -InstallTask# Install and start service
sudo ./install.sh
# Check status
systemctl status cloudflare-ddns- Cloudflare account with a domain
- API token with DNS edit permissions
- Internet connection
- Windows 10/11 or Windows Server 2016+
- PowerShell 5.1 or newer
- Administrator privileges
- Linux with systemd (Ubuntu, Debian, CentOS, etc.)
- Python 3.6+
- sudo access
- Download the PowerShell scripts to a permanent location
- Run PowerShell as Administrator
- Navigate to the script directory
- Run:
.\Update-CloudflareDDNS.ps1 - Follow the interactive menu to configure and install
- Clone the repository or download the files
- Edit
linux-config/config.jsonwith your details - Run:
sudo ./install.sh - Service starts automatically
- Log in to Cloudflare Dashboard
- Go to My Profile β API Tokens
- Click "Create Token"
- Use "Edit zone DNS" template with:
- Permissions: Zone:DNS:Edit, Zone:Zone:Read
- Zone Resources: Your specific domain
{
"Domain": "yourdomain.com",
"Hostname": "subdomain",
"ApiToken": "YOUR_API_TOKEN",
"ZoneId": "YOUR_ZONE_ID",
"TTL": 120,
"Proxied": false
}main: Windows PowerShell implementationlinux-native: Linux Python implementation
cloudflare-ddns/
βββ Windows (main branch)
β βββ Update-CloudflareDDNS.ps1
β βββ DDNS/
β β βββ CloudflareDDNS/
β β βββ CloudflareDDNS.psd1
β β βββ CloudflareDDNS.psm1
β β βββ Public/
β β βββ Private/
β βββ config/
β
βββ Linux (linux-native branch)
βββ cloudflare_ddns.py
βββ cloudflare-ddns.service
βββ install.sh
βββ uninstall.sh
βββ linux-config/
# Interactive menu
.\Update-CloudflareDDNS.ps1
# Silent update
.\Update-CloudflareDDNS.ps1 -Silent
# View logs
.\Update-CloudflareDDNS.ps1 -ShowLog# Service management
systemctl start cloudflare-ddns
systemctl stop cloudflare-ddns
systemctl restart cloudflare-ddns
systemctl status cloudflare-ddns
# View logs
journalctl -u cloudflare-ddns -f
# Manual test
python3 cloudflare_ddns.py --config /etc/cloudflare-ddns/config.json --once- Logs:
C:\ProgramData\CloudflareDDNS\*.log - Task Scheduler for status
- Logs:
/var/log/cloudflare-ddns/cloudflare-ddns.log - systemd journal:
journalctl -u cloudflare-ddns
-
Authentication Errors
- Verify API token is valid
- Check token permissions
- Ensure Zone ID is correct
-
IP Detection Failures
- Check internet connectivity
- Verify firewall allows HTTPS outbound
- Try different IP detection services
-
Service Won't Start
- Check logs for specific errors
- Verify configuration file syntax
- Ensure proper permissions
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Cloudflare for their excellent API
- Community contributors and testers
- IP detection services (ipify, ifconfig.me, etc.)
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Wiki: Project Wiki
Made with β€οΈ for the self-hosting community