A simple daemon to continuously update Hetzner DNS A and AAAA records for your server with a dynamic IP address.
It features support for multiple subdomain records with painless configuration and administration.
Officially supported operating systems:
- Alpine Linux
- Arch Linux (AUR)
- Debian / Ubuntu
- Docker (Docker Hub)
- Fedora / openSUSE (Copr)
- FreeBSD (Ports tree)
- NetBSD
- OpenWrt
Packages for the latest stable version can be found here.
Feel free to contribute to first-party support for other operating systems.
Dependencies: awk
, curl
, jq
.
# Download
git clone https://github.com/filiparag/hetzner_ddns.git
cd hetzner_ddns
# Install
sudo make install
# systemd service
sudo make systemd
# FreeBSD service
sudo make freebsd-rc
# NetBSD service
sudo make netbsd-rc
# OpenRC service
sudo make openrc
# OpenWrt procd service
sudo make openwrt-rc
Configuration file is located at /usr/local/etc/hetzner_ddns.conf
# Seconds between updates / TTL value
interval='60'
# Hetzner DNS API key
key='18fe3b02339b23ef2418f9feda1b69ef'
# Top level domain name
domain='example.com'
# Space separated host subdomains (@ for domain itself)
records='homelab media vpn'
# Enable updating A records (IPv4)
ipv4=true
# Enable updating AAAA records (IPv6)
ipv6=true
To obtain an API key, go to Hetzner DNS Console.
Default configuration location differs in prebuilt packages:
- Linux distributions:
/etc/hetzner_ddns.conf
- FreeBSD:
/usr/local/etc/hetzner_ddns.conf
- NetBSD:
/usr/pkg/etc/hetzner_ddns.conf
- OpenWrt:
/etc/config/hetzner_ddns.conf
Currently, this utility supports management of one domain per daemon. If you have multiple domains, use CNAME records to point them to one the daemon will manage, as shown in the following example:
# Managed domain (master.tld)
@ IN A 1.2.3.4
@ IN AAAA 1:2:3:4::
# Other domain
service IN CNAME master.tld.
If your operating system relies on systemd, you can easily run multiple daemons as shown below:
# Create configuration file for foobar.tld domain
sudo cp -p /usr/local/etc/hetzner_ddns.conf.sample /usr/local/etc/hetzner_ddns.foobar.conf
# Modify created file to reflect your preferences
# Enable and start foobar.tld's daemon
sudo systemctl enable hetzner_ddns@foobar
Run on startup
# systemd
sudo systemctl enable hetzner_ddns
# FreeBSD, NetBSD and OpenWrt
sudo service hetzner_ddns enable
# OpenRC
sudo rc-update add hetzner_ddns
Start/Stop
# systemd
sudo systemctl start/stop hetzner_ddns
# FreeBSD, NetBSD, OpenRC and OpenWrt
sudo service hetzner_ddns start/stop
Log file is located at /var/log/hetzner_ddns.log