Contents

Quick Start Cloudflare DDNS

This article describes the simplest way to quickly get started with Cloudflare DDNS.

We won’t go into detail here; please refer to other tutorials.

  1. Visit https://dash.cloudflare.com/profile/api-tokens
  2. Click “Create Token” and select the “Edit zone DNS” template
  3. Enter any name
  4. Set permissions to edit zone DNS:
    • Zone - Zone - Read
    • Zone - DNS - Edit
  5. For Zone Resources, select the domain for DDNS
  6. Client IP Filter (optional) — leave blank since DDNS uses dynamic IPs
  7. TTL — leave empty

Create token

After creation, copy the token.

Copy token

  1. Visit https://dash.cloudflare.com/
  2. Select the domain for DDNS
  3. Find the Zone ID in the bottom-right corner

Get zone ID

  1. Download cf-ddns-windows-x64-(version)-RELEASE.exe from the releases page and rename it to cf-ddns.exe
  2. Place it in a directory, e.g., C:\Users\[UserName]\cf-ddns
  3. Open a terminal in that directory and run:
    cf-ddns.exe -gen -zoneId=<zoneId> -authKey=<token> -domain=<domain> -v4=<true/false> -v6=<true/false>
    This checks IP every 300 seconds and updates DNS on change.

The basic usage requires the terminal to stay open. Use winsw to wrap cf-ddns.exe as a Windows service.

  1. Download cf-ddns-windows-x64-(version)-RELEASE.exe, rename to cf-ddns.exe
  2. Place it in a directory like C:\Users\[UserName]\cf-ddns
  3. Download winsw-2.12.0-bin.exe
  4. Create cf-ddns-service.xml in the same directory:
    <service>
        <id>cf-ddns</id>
        <name>cf-ddns</name>
        <description>cloudflare ddns</description>
        <workingdirectory>C:\Users\[UserName]\cf-ddns</workingdirectory>
        <executable>C:\Users\[UserName]\cf-ddns</executable>
        <startarguments>-gen -zoneId=<zoneId> -authKey=<token> -domain=<domain> -v4=<true/false> -v6=<true/false></startarguments>
        <onfailure action="restart" delay="10 sec"/>
    </service>
  5. Rename WinSW-x64.exe to cf-ddns-service.exe. Directory structure:
    C:\Users\[UserName]\cf-ddns
    ├── cf-ddns.exe
    ├── cf-ddns-service.xml
    ├── cf-ddns-service.exe
  6. Install the service:
    cf-ddns-service.exe install cf-ddns-service.xml
  7. Start the service:
    cf-ddns-service.exe start cf-ddns-service.xml
  8. Check status:
    cf-ddns-service.exe status cf-ddns-service.xml
  9. Uninstall:
    cf-ddns-service.exe uninstall cf-ddns-service.xml

The service will run in the background and survive reboots.

Service details

  1. Download cf-ddns-linux-x64-(version)-RELEASE.kexe from the releases page
  2. Rename and set permissions:
    mv cf-ddns-linux-x64-(version)-RELEASE.kexe cf-ddns && chmod +x cf-ddns
  3. Move to /usr/local/bin:
    mv cf-ddns /usr/local/bin
  4. Run:
    cf-ddns -gen -zoneId=<zoneId> -authKey=<token> -domain=<domain> -v4=<true/false> -v6=<true/false>

1-3: Same as above.

  1. Create service:

    vim /etc/systemd/system/cloudflare-ddns.service
    [Unit]
    Description=cloudflare-ddns
    After=network.target
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/cf-ddns -gen -zoneId=<zoneId> -authKey=<token> -domain=<domain> -v4=<true/false> -v6=<true/false>
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
  2. Start and enable:

    systemctl start cloudflare-ddns
    systemctl enable cloudflare-ddns

1-3: Same as above.

  1. Edit crontab:

    crontab -e
  2. Add:

    */5 * * * * /usr/local/bin/cf-ddns -gen -zoneId=<zoneId> -authKey=<token> -domain=<domain> -v4=<true/false> -v6=<true/false> -once
docker run -d \
    --network host \
    --name cf-ddns \
    --restart unless-stopped \
    selcarpa/cloudflare-ddns:latest \
    -gen -zoneId=<zoneId> -authKey=<token> -domain=<domain> -v4=<true/false> -v6=<true/false>
services:
  cf-ddns:
    image: selcarpa/cloudflare-ddns:latest
    network_mode: host
    container_name: cf-ddns
    restart: unless-stopped
    command:
      -gen -zoneId=<zoneId> -authKey=<token> -domain=<domain> -v4=<true/false> -v6=<true/false>

This article is translated by deepseek-v4-flash (model: deepseek/deepseek-v4-flash).