DDNS Sample Scripts - RMerl/asuswrt-merlin.ng GitHub Wiki

Table of Contents

Asus

Asus DDNS as a custom script.

#!/bin/sh

# Set the host name, ending with .asuscomm.com is optional
HOSTNAME='test'

# The IP address to use
IP="$1"

# Asus DDNS server
ASUS_SERVER='nwsrv-ns1.asus.com'

# Router MAC address location is hardware dependent
for LAN_MAC_NAME in et0macaddr et1macaddr et2macaddr; do
	MAC_ADDR="$(nvram get "$LAN_MAC_NAME")"
	if [ -n "$MAC_ADDR" ] && [ "$MAC_ADDR" != '00:00:00:00:00:00' ]; then
		break
	fi
done

# Use openssl to generate the password
PASSWORD="$(printf '%s' "${MAC_ADDR//:/}${IP//./}" | openssl md5 -hmac "$(nvram get secret_code)" 2>/dev/null | awk '{print toupper($2)}')"

# Try to update
HTTP_RESULT="$(curl -fs -w '%{http_code}' -o /dev/null -u "${MAC_ADDR//:/}:$PASSWORD" "http://$ASUS_SERVER/ddns/update.jsp?hostname=${HOSTNAME%.asuscomm.com}.asuscomm.com&myip=$IP")"

# Full code list https://github.com/RMerl/asuswrt-merlin.ng/blob/master/release/src/router/inadyn/plugins/asuscomm.c#L293
case "$HTTP_RESULT" in
	200|220|230)
		/sbin/ddns_custom_updated 1
	;;
	*)
		/sbin/ddns_custom_updated 0
	;;
esac

afraid.org

ℹ️
afraid.org is supported by the webui since 384.7. The following only applies to older versions.

Here is a working example, for afraid.org’s free DDNS (you can find your API key here).

#!/bin/sh

API="xxxxxxxxxxxxxxxx" # Your afraid.org API Key

curl -fs -o /dev/null "https://freedns.afraid.org/dynamic/update.php?${API}"

if [ $? -eq 0 ]; then
    /sbin/ddns_custom_updated 1
else
    /sbin/ddns_custom_updated 0
fi

AWS Route53

BIND9 DDNS using nsupdate

If you run your own DNS server with BIND9, this script uses nsupdate to update an A record. This requires that you are updating a zone configured for use with dynamic updates rather than the standard zone config files.

#!/opt/bin/bash
# A bash script to update BIND9 DDNS using nsupdate and tsig key
# Tested with bash and bind-client to be installed from entware-ng

#User variables - replace with your variables
NS="ns1.example.com"
ZONE="dynamic.example.com"
DHOST="dhost.dynamic.example.com"
TSIGFILE="/tmp/sda1/mykey.tsig"

NSUPDATE=$(which nsupdate)
IP=$1

echo "server $NS" > /tmp/nsupdate
echo "debug yes" >> /tmp/nsupdate
echo "zone $ZONE." >> /tmp/nsupdate
echo "update delete $DHOST A" >> /tmp/nsupdate
echo "update add $DHOST 600 A $IP" >> /tmp/nsupdate
echo "send" >> /tmp/nsupdate

$NSUPDATE -k $TSIGFILE /tmp/nsupdate 2>&1 &
wait $!
echo $?

if [ $?==0 ]; then
    /sbin/ddns_custom_updated 1
else
    /sbin/ddns_custom_updated 0
fi

Binero

This scripts add support for using curl with Binero.se. Edit url and credentials.

#!/bin/sh

url="first.test.com second.test.com"           # can add multiple domains separated by space
credentials=username:password                  # username and password
wanip=${1}

binero_dns_update() {
   for domain in $url
      do
         hostname='hostname='"$domain"
         myip='myip='"$wanip"
         status=$(curl -s -u "$credentials" -d "$hostname" -d "$myip" https://dyndns.binero.se/nic/update)
         logger -s -t ddns "Domain $domain reports $status"
      done
      case "$status" in
         good*|nochg*) /sbin/ddns_custom_updated 1 ;;
         abuse) /sbin/ddns_custom_updated 1 ;;
         *) /sbin/ddns_custom_updated 0 ;;
      esac
}
binero_dns_update
exit 0

ChangeIP

Here is a very basic script for ChangeIP.com.

#!/bin/sh

USERNAME="user" # Your username
PASSWORD="password" # Your password
HOSTNAME="hostname" # Your DNS hostname

curl -fs -o /dev/null "https://nic.changeip.com/nic/update?u=${USERNAME}&p=${PASSWORD}&hostname=${HOSTNAME}"

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

CloudFlare

If you use CloudFlare for your domains, this script can update any A record on your account.

#!/bin/sh

ZONEID= # Your zone id, hex16 string
RECORDID= # You DNS record ID, hex16 string
RECORDNAME= # Your DNS record name, e.g. sub.example.com
API= # Cloudflare API Key
IP=${1}

curl -fs -o /dev/null -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONEID/dns_records/$RECORDID" \
  -H "Authorization: Bearer $API" \
  -H "Content-Type: application/json" \
  --data "{\"type\":\"A\",\"name\":\"$RECORDNAME\",\"content\":\"$IP\",\"ttl\":120,\"proxied\":false}"

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

DigitalOcean

You can find details on how to obtain the record id for your DigitalOcean DNS records in this blog post.

#!/bin/sh

ACCESS_TOKEN=#See https://www.digitalocean.com/docs/api/create-personal-access-token/
DOMAIN=#YOUR-DOMAIN
RECORD_ID=#YOUR-RECORD-ID

IP=${1}

curl \
  -fs -o /dev/null \
  -X PUT \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d "{\"data\":\"$IP\"}" \
  "https://api.digitalocean.com/v2/domains/$DOMAIN/records/$RECORD_ID"

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

DNS Made Easy

#!/bin/sh
#---------------------------------------------------------------------------
# Update using dnsmadeeasy.com API
#---------------------------------------------------------------------------
update_dynamic_dns () {
  if [ -n "$WAN_IP_ADDRESS" ]; then
    logger "$0: using WAN IP address $WAN_IP_ADDRESS for dynamic DNS"
    resp=`curl -k $DYNDNS_URL`
    rcode=$?
    logger "$0: ddns response: $resp; result code: $rcode"
    if [ $resp != "success" ] && [ $resp != "error-record-ip-same" ]; then
      /sbin/ddns_custom_updated 0
      return 1
    else
      /sbin/ddns_custom_updated 1
      return 0
    fi
  else
    logger "$0: WARNING: no WAN IP address available.  Not updating dynamic DNS."
    /sbin/ddns_custom_updated 0
    return 1
  fi
}


#===========================================================================


logger "$0 event called with args: $@"

WAN_IP_ADDRESS=${1}
DYNDNS_ID="<set to your dyn DNS record ID"
DYNDNS_PASSWORD="set to your dyn DNS record password"
DYNDNS_URL="https://www.dnsmadeeasy.com/servlet/updateip?id=$DYNDNS_ID&password=$DYNDNS_PASSWORD&ip=$WAN_IP_ADDRESS"

update_dynamic_dns

DNS-O-Matic

If you use DNS-O-Matic to update your domains, this script can update all or a single host record on your account. To use this, replace dnsomatic_username, dnsomatic_password with your own values. You can refer to the DNS-O-Matic API Documentation for additional info.

Note: the HOSTNAME specified in the script below will update all records setup in your DNS-O-Matic account to have it only update a single host you will need to modify it accordingly. In some cases this may require you to specify the host entry, sometimes the domain entry.

To troubleshoot update issues you can run the curl command directly from the command line by passing in your details and removing the --silent option. If you get back good and your IP address back you’ve got it setup correctly. If you get back nohost, you’re not passing in the correct hostname value.

#!/bin/sh
# Update the following variables:
USERNAME=dnsomatic_username
PASSWORD=dnsomatic_password
HOSTNAME=all.dnsomatic.com

# Should be no need to modify anything beyond this point
/usr/sbin/curl -k --silent -u "$USERNAME:$PASSWORD" "https://updates.dnsomatic.com/nic/update?hostname=$HOSTNAME&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG&myip=$1" >/dev/null 2>&1

if [ $? -eq 0 ]; then
        /sbin/ddns_custom_updated 1
else
        /sbin/ddns_custom_updated 0
fi

Note: It seems that the DNS-O-Matic API (at least when using a single https command) does not like an email address as the user name and will fail. DNS-O-Matic no longer allows the creation of a separate user name. However there is a workaround: Your DNS-O-Matic account is the same as your OpenDNS account. If you go to my account at opendns.com and choose display name (purportedly for forum use), this will also work in this script for user name. The suggestion above about running the curl command directly from the command line to test is really useful!

dnsExit.com

ℹ️
The example below uses non-HTTPS which isn’t recommended. dnsExit.com doesn’t have HTTPS method available.

Free DNS server that also offers DDNS services.

#!/bin/sh
USER=
PASS=
DOMAIN="example.com;example.com"
URL=$(wget -qO - "http://www.dnsexit.com/ipupdate/dyndata.txt"|grep -i url|cut -f2 -d=|tr -d '\r')
set -o pipefail
wget -qO - "$URL?login=$USER&password=$PASS&host=$DOMAIN" | logger -t ddns-start
if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

DNSimple

This script adds DNSimple support, get token, account_id, zone_id and record_id from the site or API and edit all the constant variables at the top of the script.

#!/bin/sh

TOKEN="youroauth2token"   # The API v2 OAuth token
ACCOUNT_ID="123456789"    # Replace with your account ID
ZONE_ID="yourzoneid.com"  # The zone ID is the name of the zone (or domain)
RECORD_ID="123456789"     # Replace with the Record ID
IP=${1}

curl --silent \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -H "Accept: application/json" \
     -X "PATCH" \
     -i "https://api.dnsimple.com/v2/$ACCOUNT_ID/zones/$ZONE_ID/records/$RECORD_ID" \
     -d "{\"content\":\"$IP\"}" > /dev/null

if [ $? -eq 0 ]; then
    /sbin/ddns_custom_updated 1
else
    /sbin/ddns_custom_updated 0
fi

DreamHost

Requires an API key with permissions for dns-list_records, dns-remove_record, and dns-add_record.

#!/bin/sh
#-------------------
# DreamHost DNS updater, partly based on the "dreamhost-dynamic-dns"
# script by Paul Clement (github.com/clempaul/dreamhost-dynamic-dns)
#-------------------

KEY="XXXXX"
RECORD="foobar.example.com"
IP=${1}

fail() {
  /sbin/ddns_custom_updated 0
  exit 1
}

APIRequest() {
  local CMD=$1
  local ARGS=$2
  local UUID="`curl -sL 'https://uuid-serve.herokuapp.com/bulk/1'`"
  local DATA="key=${KEY}&unique_id=${UUID}&cmd=${CMD}&${ARGS}"
  local RESPONSE="`curl -s --data "${DATA}" 'https://api.dreamhost.com/'`"
  if [ $? -ne 0 ]; then fail; fi

  # If "success" is not in the response, then the request failed
  printf "${RESPONSE}" | grep "^success$" > /dev/null 2>&1
  if [ $? -ne 0 ]; then fail; fi

  printf "${RESPONSE}"
}

if [ -z "${IP}" ]; then
  logger "No IP address provided for update"
  fail
fi

# Get current record value
OLD_VALUE="`APIRequest dns-list_records 'type=A&editable=1' \
                       | grep "\s${RECORD}\sA" | awk '{print $5}'`"
if [ $? -ne 0 ]; then fail; fi

if [ "${OLD_VALUE}" != "${IP}" ]; then
  if [ -n "${OLD_VALUE}" ]; then
    # Remove the existing records
    logger "removing existing entries"
    for entry in ${OLD_VALUE}; do
      logger "Deleting entry: $entry"
      APIRequest dns-remove_record "record=${RECORD}&type=A&value=$entry" > /dev/null
    done
  fi
  # Add the new record
  logger "adding new entry: ${IP}"
  APIRequest dns-add_record "record=${RECORD}&type=A&value=${IP}"
fi

/sbin/ddns_custom_updated 1

Duck DNS

Just replace yoursubdomain and your-token with the values you got from duckdns. The hostname you set up in the GUI doesn’t matter, but I recommend setting it to your subdomain anyway.

#!/bin/sh

# register a subdomain at https://www.duckdns.org/ to get your token
SUBDOMAIN="yoursubdomain"
TOKEN="your-token"

# no modification below needed
curl --silent "https://www.duckdns.org/update?domains=$SUBDOMAIN&token=$TOKEN&ip=$1" >/dev/null 2>&1
if [ $? -eq 0 ];
then
    /sbin/ddns_custom_updated 1
else
    /sbin/ddns_custom_updated 0
fi

Dy.fi

Just edit USERNAME, PASSWORD and HOSTNAME according to your setup, and you should be good to go. Dy.fi drops hosts after 7 days of inactivity, so I’d also recommend setting the "Forced refresh interval (in days)" setting in the web ui to 7.

#!/bin/sh
# http://www.dy.fi/page/specification

USERNAME="[email protected]"
PASSWORD="yourtopsecretpassword"
HOSTNAME="yourhostname.dy.fi"

curl -D - --user $USERNAME:$PASSWORD https://www.dy.fi/nic/update?hostname=$HOSTNAME >/dev/null 2>&1

if [ $? -eq 0 ]; then
        /sbin/ddns_custom_updated 1
else
        /sbin/ddns_custom_updated 0
fi

DyNS

ℹ️
the example below uses non-HTTPS which isn’t recommended. See example for afraid above.

provide a number of free and premium DNS related services for home or office use.

#!/bin/sh
#
# http://dyns.cx/documentation/technical/protocol/v1.1.php

USERNAME=
PASSWORD=
HOSTNAME=
DOMAIN=  # optional
IP=${1}
DEBUG= # set to true while testing

URL="http://www.dyns.net/postscript011.php?username=${USERNAME}&password=${PASSWORD}&host=${HOSTNAME}&ip=${IP}"
if [ -n "${DOMAIN}" ] ; then
  URL="${URL}&domain=${DOMAIN}"
fi
if [ -n "${DEBUG}" ] ; then
  URL="${URL}&devel=1"
fi

wget -q -O - "$URL"
if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

Dynu

#!/bin/sh
#
# https://www.dynu.com/en-US/DynamicDNS/IP-Update-Protocol

HOSTNAME=YOUR-HOSTNAME.dynu.com
PASSWORD=YOUR-SUPERSECRET-PASSWORD
IP=${1}

URL="https://api.dynu.com/nic/update?hostname=${HOSTNAME}&myip=${IP}&password=${PASSWORD}"

ANSWER=$(wget -q -O - "$URL")

if [ "$ANSWER" == "good ${IP}" ] || [ "$ANSWER" == "nochg" ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

Dynu (Version 2 of DYNU’s API)

#!/bin/sh
#
# https://www.dynu.com/en-US/DynamicDNS/IP-Update-Protocol
# Note: To get your domain id, send a GET request to /dns/ with your API key in the header.

HOSTNAME=\"example.com\"
GROUP=\"yourGroup\"
PASSWORD=yourAPIKey
DOMAIN_ID=yourDomainID
IP=\"${1}\"
IPsix=null

URL="https://api.dynu.com/v2/dns/${DOMAIN_ID}"

JSON_TEMPLATE='{"name":%s,"group":%s,"ipv4Address":%s,"ipv6Address":%s}'
JSON=$(printf "$JSON_TEMPLATE" "$HOSTNAME" "$GROUP" "$IP" "$IPsix")

curl -s -o /dev/null -w "%{HTTP_CODE}" --location --request POST "$URL" -H "Content-Type:application/json" -H "accept: application/json" -H "API-KEY: $PASSWORD" -d $JSON

if [ $HTTP_CODE==200 ];then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

Dynu-Double-Nat

#!/bin/sh
#
# https://www.dynu.com/en-US/DynamicDNS/IP-Update-Protocol

HOSTNAME=YOUR-HOSTNAME.dynu.com
PASSWORD=YOUR-SUPERSECRET-PASSWORD or can use MD5 hash of password
IP=$(curl --silent http://api.ipify.org/)

URL="https://api.dynu.com/nic/update?hostname=${HOSTNAME}&myip=${IP}&password=${PASSWORD}"

ANSWER=$(wget -q -O - "$URL")

if [ "$ANSWER" == "good" ] || [ "$ANSWER" == "nochg" ] || [ "$ANSWER" == "good ${IP}" ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

EasyDNS

#!/bin/sh
#
# This script provides dynamic DNS update support for the EasyDNS service on
# the Merlin asuswrt router firmware.
#
#
#   Command Line examples you can try in your web browser or CLI
# wget -qO - "http://api.cp.easydns.com/dyn/tomato.php?login=EDIT-ME&password=EDIT-ME&wildcard=no&hostname=EDIT.ME.EM&0ED.IT0.0ME.TOO"
#
# curl -k "http://EDIT-USER:[email protected]/dyn/tomato.php?&wildcard=no&hostname=EDIT-ME&myip=0ED.IT0.0ME.TOO"


date >> /tmp/ddns-start.log
echo "$#: $*" >> /tmp/ddns-start.log

# This should be the domain (or hostname) to be updated.
# Seems as you can add more DDNS with this method, This works for me very well
# as I need two A records to be updated from DDNS.
#   You should be able to add a C, D, etc if needed.
DOMAIN_A=ADD DOMAIN HERE
DOMAIN_B=ADD 2nd DOMAIN HERE

# This is where your EasyDNS user name and the update token obtained from
# EasyDNS needs to be modified.
EASYDNS_USERNAME=Change to your login name.
EASYDNS_PASSWORD=Change to your taken.

# Set wildcard "on" if you want this to map any host under your domain
# to the new IP address otherwise "off".
WILDCARD=off

# This is set directly from http://helpwiki.easydns.com/index.php/Dynamic_DNS#Setting_up_your_system_to_use_Dynamic_DNS
# Their possibly may be another URI_BASE='https://members.easydns.com/dyn/dyndns.php'
# I have had no luck with this other URI so far, but the one currently set works great.
URI_BASE="http://api.cp.easydns.com/dyn/tomato.php"

# This is where your wan IP comes from.
WAN_IP=$1

# This is curl, update to DOMAIN_A
curl --silent -k -u "$EASYDNS_USERNAME:$EASYDNS_PASSWORD" \
        "$URI_BASE?wildcard=$WILDCARD&hostname=$DOMAIN_A&myip=$WAN_IP"

# This is curl update to DOMAIN_B Remove the comment from the last
# two lines from this section to activate the secound DDNS updater.
# If you need more updaters you should be able to copy the curl lines, and change
# DOMAIN_B to DOMAIN_X if you are on the same account and server. If not you will
# Need to make a few other changes for each.
#curl --silent -k -u "$EASYDNS_USERNAME:$EASYDNS_PASSWORD" \
#        "$URI_BASE?wildcard=$WILDCARD&hostname=$DOMAIN_B&myip=$WAN_IP"

# The last lines tell the web gui that we have or have not updated.
if [ $? -eq 0 ]; then
        /sbin/ddns_custom_updated 1
else
        /sbin/ddns_custom_updated 0
fi

EntryDNS

#!/bin/sh
# Update the following variables:
TOKEN=your_real_token

# Should be no need to modify anything beyond this point
resp=$(/usr/sbin/curl -s -k -X PUT -d "" https://entrydns.net/records/modify/$TOKEN)
rcode=$?

if [ "$rcode" == "0"  -a "$resp" == "OK" ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

Enom

This updates @ and * records so the base domain and any subdomains will also be updated. Only requires the domain password entering into the script as "pw", hostname (zone) is entered into DDNS admin web page as "host" and WAN IP is passed to script as $1

#!/bin/sh
# AsusWRT Merlin DDNS updater for Enom
# WAN IP is passed to script as $1
# host/domain should be set in the web admin
# set your domain password below
pw=WRITE_YOUR_PASSWORD_HERE

host=$(nvram get ddns_hostname_x)
ip=${1}
nserver="reseller.enom.com"

wget -O- "${nserver}/interface.asp?\
command=SetDnsHost\
&HostName=@\
&Zone=${host}\
&DomainPassword=${pw}\
&Address=${ip}"

# the following sets a wildcard (*) so that any subdomains resolve to the same ip
wget -O- "${nserver}/interface.asp?\
command=SetDnsHost\
&HostName=*\
&Zone=${host}\
&DomainPassword=${pw}\
&Address=${ip}"
if [ $? -eq 0 ]; then
         /sbin/ddns_custom_updated 1
         logger "DDNS updated ${host} set to ${ip}"
else
         /sbin/ddns_custom_updated 0
fi

Gandi

This updates the @ and www subdomains of a type A record while leaving the others intact. Change the SUBDOMAIN variable to update a specific A Record.

#!/bin/sh

APIKEY="XXXXXXXXXXXXXXXXXXXXXXXX" # Your 24-character API key
DOMAIN="example.com" # The domain to be updated
SUBDOMAIN="{@,www}" # The Sub-Domain to update, use {@,*} to update base domain (*.example.com), or change to "home" for home.example.com

IP=${1}
#IP="$(curl -fs4 https://myip.dnsomatic.com/)" # to retrieve IP address in case of double NAT

curl -fs -o /dev/null \
    -X PUT "https://api.gandi.net/v5/livedns/domains/${DOMAIN}/records/${SUBDOMAIN}/A" \
    -H "Authorization: Apikey ${APIKEY}" \
    -H "Content-Type: application/json" \
    -d "{
        \"rrset_values\": [
            \"${IP}\"
        ]
    }"

if [ $? -eq 0 ]; then
	/sbin/ddns_custom_updated 1
else
	/sbin/ddns_custom_updated 0
fi

Google Domains

ℹ️
Asus added built-in Google Domains support at some point, so check first if your current firmware version offers it on the webui.

Transfer your domain to Google and enjoy free DDNS and other features.

#!/bin/sh

set -u

U=xxxx
P=xxxx
H=xxxx

# args: username password hostname
google_dns_update() {
  CMD=$(curl -s https://$1:$2@domains.google.com/nic/update?hostname=$3)
  logger "google-ddns-updated: $CMD"
  case "$CMD" in
    good*|nochg*) /sbin/ddns_custom_updated 1 ;;
    abuse) /sbin/ddns_custom_updated 1 ;;
    *) /sbin/ddns_custom_updated 0 ;;
  esac
}

google_dns_update $U $P $H

exit 0

Inernet.bs

#!/bin/sh

USER=username-goes-here
PASS=unbreakable-password
DOMAIN=mydomain.site

wget --no-check-certificate -qO - "https://dyndns.topdns.com/update?hostname=$DOMAIN&username=$USER&password=$PASS"

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

INWX - InterNetworX

German registrar with great API for everything DNS. The domain to update is specified when setting up their DynDNS service. Each dyndns-domain gets a separate user & password. 1 domain is free.

#!/bin/sh

IP=$1
USER=your_dyndns_user
PASSWORD=your_dyndns_password

curl -s -u $USER:$PASSWORD "https://dyndns.inwx.com/nic/update?myip=$IP"

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

Joker.com

Activate Dynamic DNS Authentication from DNS control panel in order to get authentication details that you will need in the following example. Create a DYNA or DYNAAAA record and choose your subdomain. Your IP is detected automatically at this point, but you can change it, so you can confirm your setup is working.

#!/bin/sh
USERNAME=your_username
PASSWORD=your_password
DOMAIN=your_domain (e.g. subdomain.example.com)
curl -k "https://svc.joker.com/nic/update?username=$USERNAME&password=$PASSWORD&hostname=$DOMAIN" >/dev/null 2>&1 &

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

Loopia

This scripts add Loopia support using curl just edit hostname and cred.

#!/bin/sh
#https://support.loopia.com/wiki/CURL
url=                                            # add the domain name here (example: test.com)
credentials=                                    # add username and password here (example: username:password)

resolver=https://dns.loopia.se/XDynDNSServer/XDynDNS.php
wanip=${1}

loopia_dns_update() {
for domain in $url
do
   redirect="$resolver"'?hostname='"$domain"'&'myip="$wanip&wildcard=NOCHG"
   status=$(curl -s --user "$credentials" "$redirect")
   logger -s -t ddns "The following domain $domain reports $status"
done
case "$status" in
    good*|nochg*) /sbin/ddns_custom_updated 1 ;;
    abuse) /sbin/ddns_custom_updated 1 ;;
    *) /sbin/ddns_custom_updated 0 ;;
esac
}

loopia_dns_update
exit 0

Namecheap

If you use Namecheap for your domains, this script can update any A record on your account. The script is currently (as of Aug 1 2015) required because the built-in script uses HTTP, while Namecheap requires HTTPS. To use this, replace HOSTS, DOMAIN and PASSWORD with your own values. You can refer to the DDNS FAQ at Namecheap for steps required.

#!/bin/sh
# Update the following variables:
# For more than one host, use space to separate hosts
HOSTS="hostname"
#HOSTS="hostname1 hostname2"
DOMAIN=domain.com
PASSWORD=XXXXXXXXXXXXXXXXXXXXXXXX

# Should be no need to modify anything beyond this point
IP=$1
STATUS=0
for HOSTNAME in $HOSTS; do
  /usr/sbin/wget --no-check-certificate -qO - "https://dynamicdns.park-your-domain.com/update?host=$HOSTNAME&domain=$DOMAIN&password=$PASSWORD&ip=$IP"
  if [ $? -ne 0 ]; then
    STATUS=1
  fi
done
if [ $STATUS -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

OVH

Tested and working on spanish version of OVH but should work in any language. This is a Domain/Hosting provider, if you have domains with them you can use their DDNS service with the following script.

#!/bin/sh

###
# Git development:
# https://gist.github.com/atais/9ea6595072096ab8077f619bd3648da8
# Based on
# https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-DDNS#google-domains
# https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-DDNS#bind9-ddns-using-nsupdate
###

#set -u

USER=YOUR USER IN DDNS CONFIG
PASS=YOUR PASSWORD IN DDNS CONFIG
HOST=mydomain.com

# args: username password hostname ip
ovh_dns_update() {
  CMD=$(curl -s -u $1:$2 "https://www.ovh.com/nic/update?system=dyndns&hostname=$3&myip=$4")
  logger "ovh-ddns-updated: $CMD"
  case "$CMD" in
    good*|nochg*) /sbin/ddns_custom_updated 1 ;;
    *) /sbin/ddns_custom_updated 0 ;;
  esac
}

IP=$1
### you can obtain your external IP with this API
#IP=$(curl -s ifconfig.co)
ovh_dns_update $USER $PASS $HOST $IP

exit 0

Pair Domains

This will add/update A records for Pair DDNS.

#!/bin/sh
# https://www.pairdomains.com/kb/posts/336?from=pairnic
# make sure this file has eXecutable atrributes
# use @.mypairdomain.com for top-level or subdomain.mypairdomain.com
host=
pass=

wanip=$1
hostx=$(echo $host | sed 's/@.//')
resolvedip=$(nslookup $hostx | grep $hostx -A1 | awk '/^Address / {print $3}')

if [ "$wanip" == "$resolvedip" ]; then
      logger "DDNS: WAN IP ($wanip) unchanged, no update necessary"
      /sbin/ddns_custom_updated 1
else
		response=$(curl -s https://pairdomains:$pass@dynamic.pairdomains.com/nic/update?hostname=$host)
        if [ "$response" == "good $wanip" ]; then
            logger "DDNS: DNS updated to $wanip from $resolvedip"
            /sbin/ddns_custom_updated 1
        else
            logger "DDNS: Update error. $response"
            /sbin/ddns_custom_updated 0
        fi
fi

pdd.yandex.ru

If you use domain.yandex.com for your domains, this script can update any A/AAAA record on your account. Replace router.yourdomain.com, token and id with your own values.

#!/bin/sh
# Get token at https://pddimp.yandex.ru/token/index.xml?domain=yourdomain.com
token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Get record ID from https://pddimp.yandex.ru/nsapi/get_domain_records.xml?token=$token&domain=yourdomain.com
# <record domain="router.yourdomain.com" priority="" ttl="21600" subdomain="router" type="A" id="yyyyyyyy">...</record>
id=yyyyyyyy

/usr/sbin/curl --silent "https://pddimp.yandex.ru/nsapi/edit_a_record.xml?token=$token&domain=yourdomain.com&subdomain=router&record_id=$id&ttl=900&content=${1}" > /dev/null 2>&1
if [ $? -eq 0 ];
then
    /sbin/ddns_custom_updated 1
else
    /sbin/ddns_custom_updated 0
fi

porkbun

If you use porkbun for your domains, this script can update any record on your account. Populate APIKEY, SECRET_KEY, DOMAIN and ID with your own values. You can find the ID of needed record by retrieving the DNS records from API (see https://porkbun.com/api/json/v3/documentation). Get API keys at https://porkbun.com/account/api

#!/bin/sh

IP=${1}
APIKEY="pk1_xxxxxxx"
SECRET_KEY="sk1_xxxxxx"
DOMAIN="yourdomain.com"
SUBDOMAIN="router-or-your-own-subdomain"
ID="your-numeric-dns-record-id"

RESPONSE=$(curl -sb \
    -X POST https://porkbun.com/api/json/v3/dns/edit/$DOMAIN/$ID \
    -H "Content-Type: application/json" \
    -d "{\"secretapikey\":\"$SECRET_KEY\",\"apikey\":\"$APIKEY\",\"name\":\"$SUBDOMAIN\",\"type\":\"A\",\"content\":\"$IP\"}")

if [ "$RESPONSE" = '{"status":"SUCCESS"}' ] || [ "$RESPONSE" = '{"status":"ERROR","message":"Edit error: We were unable to edit the DNS record."}' ];
# second response means no change
then
    /sbin/ddns_custom_updated 1
else
    /sbin/ddns_custom_updated 0
fi

Strato

Strato uses the DynDNS v2 protocol from dyndns.org to execute the DynDNS-update.

  • Server : https://dyndns.strato.com/nic/update

  • Host : the domain or subdomain that you want to refer to (example: myrouter.yourstratodomain.com)

  • User : the domain from your contract (example: yourstratodomain.com)

  • Password: the Dynamic DNS-password that you have configured in your Security dashboard

#!/bin/sh

USERNAME="<my-username>"
PASSWORD="<my-password>"
HOSTNAME="<my-hostname>"

# Should be no need to modify anything beyond this point

curl -D - --user $USERNAME:$PASSWORD https://dyndns.strato.com/nic/update?hostname=$HOSTNAME >/dev/null 2>&1

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi

Woima.fi

Woima is a free Finnish Dynamic DNS service. After ordering you’ll get the necessary info in an e-mail. Pay attention to the URL in the e-mail. Every example I encountered had dyn.woima.fi/update. Mine on the other hand was nic/update.

#!/bin/sh
USERNAME=your_username
PASSWORD=your_password
HOSTNAME=your_domain (e.g. subdomain.dyn.woima.fi)
curl -D - -4 --user $USERNAME:$PASSWORD  https://dyn.woima.fi/nic/update?$HOSTNAME >/dev/null 2>&1

if [ $? -eq 0 ]; then
        /sbin/ddns_custom_updated 1
else
        /sbin/ddns_custom_updated 0
fi

Godaddy

#!/bin/sh

IP=${1}
APIKEY="INSERT_YOUR_GODADDY_API_APP_KEY_HERE"
SECRET_KEY="INSERT_YOUR_GODADDY_API_SECRET_KEY_HERE"
DOMAIN="INSERT_YOUR_GODADDY_DOMAIN_NAME_HERE"
HOST="INSERT_HOSTNAME_TO_UPDATE_HERE"

curl -X PUT https://api.godaddy.com/v1/domains/$DOMAIN/records/A/$HOST
-H "Authorization: sso-key $APIKEY:$SECRET_KEY"
-H "Content-Type: application/json"
-d "[{"type": "A","name": "$HOST", "ttl": 600, "data": "$IP"}]"

if [ $? -eq 0 ];
then
/sbin/ddns_custom_updated 1
else
/sbin/ddns_custom_updated 0
fi
⚠️ **GitHub.com Fallback** ⚠️