Skip to content

Dynamic DNS

Calin Crisan edited this page May 5, 2022 · 4 revisions

How It Works

Systems that live behind a network with a dynamic public IP address can be accessed via a known domain name managed by a so-called dynamic DNS service.

The init script S97dyndns runs at each boot and executes dyndns-update. Cron will also execute dyndns-update every 15 minutes.

dyndns-update will do nothing unless the /data/etc/dyndns-update.sh is present. /data/etc/dyndns-update.sh is ultimately responsible of actually updating the DNS record.

The output of the dynamic DNS update procedure can be found in /var/log/messages, marked with dyndns tag.

Configuration

Simply create the /data/etc/dyndns-update.sh file and place the dynamic DNS updating command inside. This command differs from one dynamic DNS provider to another but is usually an HTTP request performed with cURL (see examples below).

The recommended cURL command line args are -Ss, telling it to not output the response, but to show the error if any. Adding -f will make the script exit with erroneous status in case of non-2xx HTTP responses.

Make sure to surround the URL in quotes so that special characters such as & are properly passed to the curl process.

Examples

DuckDNS

After logging in to www.duckdns.org, copy the displayed token and use it together with your domain name (without the .duckdns.org) to form the cURL command and add it to /data/etc/dyndns-update.sh:

curl -Ssf "https://www.duckdns.org/update?domains=<yourdomain>&token=<yourtoken>"

Afraid

The URL for freedns.afraid.org can be found under Dynamic DNS > Direct URL. Just copy the link and add it to /data/etc/dyndns-update.sh:

curl -Ssf "http://freedns.afraid.org/dynamic/update.php?<yourtoken>"

NoIP

For www.noip.com, you'll need your username, password and full domain name to form the following command and add it to /data/etc/dyndns-update.sh:

curl -Ssf "http://<yourusername>:<yourpassword>@dynupdate.no-ip.com/nic/update?hostname=<yourdomain>"
Clone this wiki locally