Skip to content

Python script to dynamically update DNS records on Cloudflare using Synology NAS DSM DDNS integration. Fully compatible with DSM 7.x, including DSM 7.2.2.

Notifications You must be signed in to change notification settings

syanyong/synology-nas-ddns-cloudflare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Synology NAS DDNS with Cloudflare

This Python script integrates with Synology DSM to dynamically update DNS records on Cloudflare. It works with Synology's DDNS system by accepting parameters directly from DSM's DDNS configuration.

Features

  • Supports Cloudflare API for DNS updates.
  • Compatible with Synology DSM's DDNS feature.
  • Automatically fetches public IP if not provided.
  • Tested and verified on DSM 7.2.2.

Installation

  1. SSH into Synology NAS:

    • Open a terminal on your computer and connect to your Synology NAS via SSH:
    • Make the script executable:
      ssh admin@<NAS_IP>
  2. Copy the Script to Synology NAS:

    • Download the Script:
      wget https://raw.githubusercontent.com/syanyong/synology-nas-ddns-cloudflare/refs/heads/main/cloudflare_ddns.py .
    • Copy:
      cp cloudflare_ddns.py /usr/syno/bin/ddns
    • Make the script executable:
      sudo chmod +x /usr/syno/bin/ddns/cloudflare_ddns.py
  3. Update Synology Configuration:

    • Edit /etc.defaults/ddns_provider.conf:
      [Cloudflare]
          modulepath=/usr/syno/bin/ddns/cloudflare_ddns.py
          queryurl=https://api.cloudflare.com
  4. Add DDNS in DSM (UI):

    • Go to Control Panel > External Access > DDNS.
    • Add a new entry:
      • Service Provider: Cloudflare
      • Hostname: <RECORD_ID> (DNS record ID)
      • Username: <ZONE_ID> (Cloudflare Zone ID)
      • Password: <API_TOKEN> (Cloudflare API Token)

Compatibility

  • Tested and verified on:
    • Synology DSM 7.2.2
    • Cloudflare API v4
  • Expected to work on all DSM 7.x versions.

Usage

  1. Parameters Passed by Synology:

    • $1: ZONE_ID (username in DSM configuration)
    • $2: API_TOKEN (password in DSM configuration)
    • $3: RECORD_ID (hostname in DSM configuration)
    • $4: IP (optional, automatically detected if not provided)
  2. Manual Execution: You can test the script manually:

    /usr/syno/bin/ddns/cloudflare_ddns.py <ZONE_ID> <API_TOKEN> <RECORD_ID> <IP>

Author

This project was created and maintained by Sarucha Yanyong. GitHub: @syanyong

About

Python script to dynamically update DNS records on Cloudflare using Synology NAS DSM DDNS integration. Fully compatible with DSM 7.x, including DSM 7.2.2.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages