Skip to content

About

Sync a Cloudflare DNS record with your public IP address.

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Repository files navigation

Cloudflare DDNS

GitHub release (latest by date) Build Go Report Card

Cloudflare DDNS is a command-line dynamic DNS tool that keeps Cloudflare DNS records in sync with your public IP address.

Features

  • Multiple IP Sources: Tries multiple sources in order for fetching your public IP:
    • Cloudflare DNS (TLS) (using whoami.cloudflare)
    • OpenDNS (TLS) (using myip.opendns.com)
    • Cloudflare STUN (using stun.cloudflare.com)
    • Google STUN (using stun.l.google.com)
    • icanhazip.com
    • AWS
    • ipinfo.io
    • ipify.org
    • Cloudflare DNS (using whoami.cloudflare)
    • OpenDNS (using myip.opendns.com)
  • Future Compatibility: Supports managing A and AAAA records.
  • Flexible Usage: Run as a one-off command for use with cron/systemd/Kubernetes, or as a daemon with a configurable update interval.
  • Simple Authentication: Use either CF_API_TOKEN or CF_API_KEY with CF_API_EMAIL to securely connect to the Cloudflare API.

Installation

APT (Ubuntu, Debian)

Click to expand
  1. If you don't have it already, install the ca-certificates package

    sudo apt install ca-certificates
  2. Add gabe565 apt repository

    echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list
    
  3. Update apt repositories

    sudo apt update
  4. Install cloudflare-ddns

    sudo apt install cloudflare-ddns

RPM (CentOS, RHEL)

Click to expand
  1. If you don't have it already, install the ca-certificates package

    sudo dnf install ca-certificates
  2. Add gabe565 rpm repository to /etc/yum.repos.d/gabe565.repo

    [gabe565]
    name=gabe565
    baseurl=https://rpm.gabe565.com
    enabled=1
    gpgcheck=0
  3. Install cloudflare-ddns

    sudo dnf install cloudflare-ddns

AUR (Arch Linux)

Click to expand

Install cloudflare-ddns-bin with your AUR helper of choice.

Homebrew (macOS, Linux)

Click to expand

Install cloudflare-ddns from gabe565/homebrew-tap:

brew install gabe565/tap/cloudflare-ddns

Docker

Click to expand

A Docker image is available at ghcr.io/gabe565/cloudflare-ddns

Manual Installation

Click to expand

Download and run the latest release binary for your system and architecture.

Usage

To authenticate to the Cloudflare API, set either CF_API_TOKEN or CF_API_KEY and CF_API_EMAIL.

One-Off Mode

Runs once, then exits. Useful for crontab, systemd timers, or Kubernetes CronJobs.

Local

export CF_API_TOKEN=token
cloudflare-ddns example.com

Docker

docker run --rm -it \
  -e CF_API_TOKEN=token \
  -e DDNS_DOMAINS=example.com \
  ghcr.io/gabe565/cloudflare-ddns \

Daemon Mode

Runs continuously, updating the DNS record every specified interval.

Local

export CF_API_TOKEN=token
cloudflare-ddns example.com --interval=10m

Docker

docker run --rm -d --restart=always \
  -e CF_API_TOKEN=token \
  -e DDNS_DOMAINS=example.com \
  -e DDNS_INTERVAL=10m \
  ghcr.io/gabe565/cloudflare-ddns

Full Reference

About

Sync a Cloudflare DNS record with your public IP address.

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages