Files
mxmehl a7d2b6cf4e feat!: adapt to v2 server (#1)
Great simplification as more logic is on server now

Reviewed-on: #1
Co-authored-by: Max Mehl <mail@mehl.mx>
2026-10-22 15:37:01 +02:00

2.4 KiB

Snap DynDNS Client

Snap DynDNS Client is the counterpart to Snap DynDNS Server. It is a small POSIX shell script that tells the server to point your hostnames to the address this machine connects from. Only curl 7.76 or newer is needed (for --fail-with-body).

The script does not look up or compare IP addresses itself. The server sees the address of the request and only contacts the DNS provider if it changed, so running the script every minute is cheap.

Installation

Clone the repository, copy config.cfg.sample to config.cfg and edit it:

  • SERVER: the URL of /nic/update on your server
  • HOSTS: space-separated hostname:token pairs, the tokens are created on the server with its helper script, snap_dyndns_host.py HOSTNAME, which prints the hostname:token pair to paste here
  • IPV4 / IPV6: which address families to update (IPv6 needs an AAAA record at INWX and a working IPv6 connection of this machine)

Make sure only you can read the config, as it contains the tokens:

chmod 600 config.cfg

Run it from cron, for example every minute:

* * * * * /path/to/snap-dyndns-client/dnsupdate.sh >/dev/null
# Or if you would like to log the output to a file
# * * * * * /path/to/snap-dyndns-client/dnsupdate.sh > /path/to/snap-dyndns-client/update.log 2>&1

Errors are printed to stderr together with the answer of the server (for example badauth or 911), so cron mails them to you. With -c you can use another config file:

dnsupdate.sh -c /path/to/other.cfg

Output and exit code

A line with the date and time ([2026-10-22 14:54:44]), followed by one line per hostname and address family, with the answer of the server (good <ip> after a change, nochg <ip> otherwise). The exit code is 1 if any update failed. If the IPv6 request is answered with an IPv4 address, the machine has no usable IPv6 connectivity (curl -6 can silently fall back to IPv4), and the script reports that as a failure. Set IPV6=false in that case.

Migrating from the previous version

The old script looked up the IP at an external service, kept old*.ip files, wrote update-*.log files, and supported ignoring IPs and Tor exit nodes. All of that is gone. It requires the new server, and the config format changed: DOMAIN[n], USER[n] and PASS[n] are now one HOSTS entry, and SERVER points to /nic/update.

License

GPL-3.0-or-later, see LICENSE.