OpenDynamicDNS Code
Dynamic DNS Updatescript and Web Management
Status: Beta
Brought to you by:
nrze
SETUP ========================================== System prerequisites -------------------- - Installed and configured nameserver (e.g. BIND) - Updatescript (within this document) - Webserver with PHP any MySQL - NS Record with all domains you want to manage to your DNS Server Please note that the webinterface is able to run on almost any system. Although all examples require a unix-like system running a nameserver which can be updated by nsupdate. Feel free to write your own update routines for other nameservers or operating systems. Configuring Nameserver and Updatescript --------------------------------------- This example shows how to configure the bind Nameserver for dynamic DNS updates. 1) Run ddns-confgen -z dyn.YOURDOMAIN.com Output: # To activate this key, place the following in named.conf, and # in a separate keyfile on the system or systems from which nsupdate # will be run: key "ddns-key.dyn.YOURDOMAIN.com" { algorithm hmac-sha256; secret "k2AnrALavnLKtonVsbSBO+JCc0se17/prHSKc2ba3d8="; }; # Then, in the "zone" definition statement for "dyn.YOURDOMAIN.com", # place an "update-policy" statement like this one, adjusted as # needed for your preferred permissions: update-policy { grant ddns-key.dyn.YOURDOMAIN.com subdomain dyn.YOURDOMAIN.com A AAAA; }; # After the keyfile has been placed, the following command will # execute nsupdate using this key: nsupdate -k <keyfile> The named.conf zonedefinition should now look like this: zone "dyn.YOURDOMAIN.com" { type master; file "/var/cache/bind/db.dyn.YOURDOMAIN.com"; update-policy { grant ddns-key.dyn.YOURDOMAIN.com subdomain dyn.YOURDOMAIN.com A AAAA; }; }; In this example updates are restricted to the subdomain only. Don't forget co create the key file (/etc/bind/dyn.YOURDOMAIN.com.ddns-key). Also create a db-file (/var/cache/bind/db.dyn.YOURDOMAIN.com) if it not exists yet. 2) In order to update the records, webinterface executes a bash script which is defined within the config.ini file. The script should look like this: #!/usr/bin/env bash DOMAIN=$1 IP=$2 V=$3 KEY=/etc/bind/dyn.YOURDOMAIN.com.key TIMEOUT="60" if [ "$V" = "6" ]; then echo -e " update delete $DOMAIN AAAA update add $DOMAIN $TIMEOUT AAAA $IP show send" | /usr/bin/nsupdate -k $KEY else echo -e " update delete $DOMAIN A update add $DOMAIN $TIMEOUT A $IP show send" | /usr/bin/nsupdate -k $KEY fi Running Installer ----------------- run http://yourdomain.com/install.php and follow the installation instructions. UPDATING RECORDS ========================================== Updates can be made by a simple HTTP get call to updateip.php The following parameters are avaialable Parameter Mandatory Description --------- --------- ------------------------------------------------------------------ hostname yes Your Domain Name myip no ipv4 address, clientaddress is used if nothing else is specified. my6ip no ipv6 address, clientaddress is used if nothing else is specified. username no either you specify username or you perform http auth. password no either you specify password or you perform http auth. example: http://yourdomain.com/updateip.php?hostname=<hostname>&ipaddr=<ipaddr>&username=<username>&password=<password> Most Dynamic DNS Clients support updates by calling an update URL like shown within the example above. Please refer to your device's manufacurers manual in order to get the correct variables. AVM FritzBox Users ------------------ example: http://yourdomain.com/updateip.php?ipaddr=<ipaddr>&hostname=<domain>&ip6addr=<ip6addr> Username and password need to be specified within the corresponding fields.