Skip to content is a small shell script that monitors the access logs of your webserver to update NS records of configured domains in NSD.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
dynnsd.d - DDNS with NDS is a small shell script that monitors the access logs of your webserver to update NS records of configured domains in NSD.

It's based on the works of Mike J. Savage and Michael Clemens.

Preparing your nameserver requires an NSD name server that is configured to serve your zone (e.g. It relies on nsd-control that must be configured too. It needs reading access to your logfile an write access to the folder for your dynamic zone files.

The few other used tools (awk, grep, cat, cron) should be system independend. Your dynamic host should give you the possibility to run cron jobs and access a web site (e.g. with curl).


Nothing special here.

        control-enable: yes

        zonefile: /usr/local/etc/nsd/zones/


This is a pretty standard zone file. It serves and the hosts that we need to update the NS records. In the last line we include the zone file for the dynamic host. In the script we call it $MAIN_ZONEFILE.

$TTL 3600
@                       IN      SOA (
                        2018060301              ; Serial number
                        10800                   ; Refresh
                        3600                    ; Retry
                        604800                  ; Expire
                        86400)                  ; Minimum TTL

                        ; Nameserver definition
                        IN      NS
                        IN      NS

                        ; Mail exchanger definition
                        IN      MX      10

; A records definition
@                 300     IN      A
update	       		300	    IN	    A
4.update			    300	    IN	    A

; AAAA records definition
@                 300     IN      AAAA   fe80:4000:35:11d::14
update			      300	    IN      AAAA   fe80:4000:35:11d::14
6.update			    300	    IN      AAAA   fe80:4000:35:11d::14

; CNAME records
www 300 CNAME @

$INCLUDE /usr/local/etc/nsd/zones/dyn/


This is the zone file that will automagically be created by Nothing to do here. 300 IN A 300 IN AAAA fe80:23:185:12::191

Configuring your web server

Your webserver has to be configured to server 2 domains. One of them has to be IPv6 only and the other one has to be IPv4 only. Both virtual servers has to be logged to the same logfile.

In nginx we have to define a new log_format that includes the queried host name.


http {
    log_format access '$host $remote_addr - $remote_user [$time_local] '
                               '"$request" $status $body_bytes_sent '
                               '"$http_referer" "$http_user_agent" "$gzip_ratio"';

    server {
        listen 80;
        listen [::]:80;


        root /usr/local/www/;
        access_log /usr/local/www/ access;


We create file to prevent 404 errors.

touch /usr/local/www/ itself

The script only wants a few small settings in the config file. Point to your web server log and your zone file, tell him the name of the update hosts, set a password and you're done.


## The domain that you want to update

## The secret to authenticate you

## The host to query for updating your NS records
## Uncomment UPDATE6 and put in the URL that can be only resolved via IPv6.

## The logfile of the virtual server that should be monitored

## The zone files that you want to update

The cron jobs

Finally we have to define some cron jobs on the host and the server.

I set them to run every minute but you can change this if you want to. The cron job on the server makes the magic happen. The cron job on the client queries the webserver so we can get the IPs from the log file.

On server

*1 * * * * /root/bin/

On the dynamic client

*1 * * * * curl --silent<YOURSECRET> > /dev/null
*1 * * * * curl --silent<YOURSECRET> > /dev/null

That's it. Small and handy.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.