[HowTo] DDNS Mega Thread

Nice [HowTo] ! Thanks @Toast.

I would had this one :

DtDNS

This script update the recorded WAN IP with DtDNS service for a given hostname

#!/bin/bash

#The hostname we want to update followed by the domain you chose on
HOSTNAME='myhostname.dtdns.net'
#Your DtDNS.com account password
PASSWD='yourPassword'

echo "$(date)"

#Checking current external IP address
EXT_IP=`dig +short myip.opendns.com @resolver1.opendns.com`
echo "External IP address is $EXT_IP"

#Checking which IP dtDNS currently has recorded by checking their DNS server
LAST_IP=`nslookup $HOSTNAME ns1.dtdns.com | tail -2 | awk '{ print $2 }'`
echo "DtDNS recorded IP address for $HOSTNAME is $LAST_IP"

#Comparing the IP addresses, if different sending GET request
if [ "$EXT_IP" != "$LAST_IP" ]; then
	echo "IP addresses don't match. Sending update request...."
	curl -s "https://www.dtdns.com/api/autodns.cfm?id=$HOSTNAME&pw=$PASSWD&ip=$EXT_IP"
	echo "Update request sent."
	echo "Done."
	exit 0
fi

Save this script as ‘dtdnsupdate.sh’ in ‘/home/osmc/scripts’

Then

cd /home/osmc/scripts
sudo chmod +x dtdnsupdate.sh
crontab -e

if you want some output for testing purpose add this line at end of file

*/10 * * * * /home/osmc/scripts/dtdnsupdate.sh >> /home/osmc/scripts/dtdnsupdate.log

otherwise

*/10 * * * * /home/osmc/scripts/dtdnsupdate.sh >> /dev/null 2 > &1

don’t forget to add a blank line at the end of crontab file.

1 Like