Synology Cloudflare DDNS Script
How to use
Access Synology via SSH
- Login to your DSM
- Go to Control Panel > Terminal & SNMP > Enable SSH service
- Use your client or commandline to access Synology. If you don't have any, I recommand you can try out MobaXterm for Windows.
- Use your Synology admin account to connect.
Run commands in Synology
cloudflareddns.shfrom this repository to
wget https://raw.githubusercontent.com/joshuaavalon/SynologyCloudflareDDNS/master/cloudflareddns.sh -O /sbin/cloudflaredns.sh
It is not a must, you can put I whatever you want. If you put the script in other name or path, make sure you use the right path.
- Give others execute permission
chmod +x /sbin/cloudflaredns.sh
cat >> /etc.defaults/ddns_provider.conf << 'EOF' [Cloudflare] modulepath=/sbin/cloudflaredns.sh queryurl=https://www.cloudflare.com/ E*.
queryurl does not matter because we are going to use our script but it is needed.
Get Cloudflare parameters
- Go to your domain overview page and get the Zone ID.
- Go to your account setting page and get API Key.
- Get record id using Cloudflare API.
curl -X GET "https://api.cloudflare.com/client/v4/zones/[Zone ID]/dns_records" \ -H "X-Auth-Email: [Email]" \ -H "X-Auth-Key: [API Key]" \ -H "Content-Type: application/json"
You need to replace with  with your parameter. Then, you get the
result which is you Record ID.
- Enter the parameters to the
- Login to your DSM
- Go to Control Panel > External Access > DDNS > Add
- Select Cloudflare as service provider. Enter your domain as hostname, your Cloudflare account as Username/Email, and API key as Password/Key
__USERNAME__, __PASSWORD__, __HOSTNAME__, __MYIP__
These are the parameters from Synology.
DNS record type
Time to live for DNS record. Value of 1 is 'automatic'
Whether the record is receiving the performance and security benefits of Cloudflare.
Log file location
You can read the Cloudflare API documentation v4 for more details.