Skip to content

alcroito/digitalocean-dyndns

Repository files navigation

Dynamic DNS using DigitalOcean's DNS API

Logo

GitHub Source GitHub Registry Docker Pulls GitHub Workflow Status License

A Unix daemon that periodically updates DigitalOcean domain records with the current machine's public IP address.

How it works

The daemon periodically runs the following steps:

  • finds the current machine's public IPv4 or IPv6 by sending a DNS request to an OpenDNS resolver
  • queries the configured domain records using DO's API. If the queried IPs are different from the current public IP, the domain records are updated to point to the new IP

Setup

  • A Unix (Linux / macOS) server to run the daemon
  • A DigitalOcean account with your domain associated to it
  • An existing A or AAAA record for each domain to be updated
  • Configure the app either using CLI, env vars or a config file

Usage

There are 2 configuration modes: simple and advanced.

Simple mode allows updating only one single domain record. Simple mode can be configured via command line arguments, environment variables or a config file.

Advanced mode allows updating multiple domains and records. Advanced mode can only be configured via the config file. It is also the (currently) only mode that supports ipv6 assignments.

See do_ddns.sample.toml for a sample configuration file.

Run do_ddns -h to see the available command line options and environment variables.

Build requirements

To build the application you need a recent enough version of the Rust compiler (1.45+). Build using cargo build. The executable will be placed into $PWD/target[/target-arch]/do_ddns.

Docker images and docker-compose

Docker images based on Alpine Linux (~7MB) are available for your server-y needs.

They are regularly built using Github Actions for the following platforms:

  • linux/amd64
  • linux/arm64
  • linux/arm/v7

They can be downloaded from DockerHub and the Github Container registry.

An easy way to use them is via the sample docker-compose.yaml file.

LICENSE

MIT

Alternative implementations

  • tunix/digitalocean-dyndns
    • written in Bash
    • provides amd64 alpine-based docker image ~5MB
    • uses curl/HTTP for IP resolving (3 possible services)
    • appears to be maintained 👏
  • skibish/ddns
    • written in Golang
    • provides amd64 alpine-based docker image ~8MB
    • uses HTTP for IP resolving (3 possible services)
    • supports update notification via SMTP and Telegram
    • supports resolving IPv6 addresses
    • supports updating multiple domain records of different types (A, CNAME, TXT)
    • provides standalone binaries for darwin/amd64, linux/armv7, linux/amd64, windows/amd64
    • appears to be maintained 👏
  • KyleLilly/do-dyndns
    • written in Javascript/NodeJS
    • runs as a server expecting PUT requests
    • provides Dockerfile, but no image
    • doesn't resolve the public ip
    • appears unmaintained 👎
  • creltek/digitalocean-dyndns
    • written in Python
    • uses one HTTP based service for IP resolving
    • provides Dockerfile, but no image
    • appears unmaintained 👎
  • FMCorz/digitalocean-dyndns
    • written in Python
    • uses one HTTP based service for IP resolving
    • appears unmaintained 👎
  • Many others that appear unmaintained or don't provide docker images