Better Bring a Bindle Buddy.
- Monday, August 13 2018 @ 02:08 pm EDT
- Contributed by: masodo
- Views: 3,252
Getting shut out of your your own home is certainly disconcerting (to say the least.) If you frequently connect to your home's network infrastructure from the outside world you'd like to think it will be there when you need it.
For many many years I had relied on Darktech.org to track my local network as InfinitelyRemote.DtDNS.net; which was working splendidly right up to the point when they "pulled the plug" on the service. Luckily my IP address had not changed for quite a while so I was still able to stay connected by directly accessing 99.32.165.173. It was while investigating the loss of service that I discovered a single tweet on the subject posted by Tru Huynh @huynh_tru dated July 2 that said simply: thank you and farewell #dtdns (https://www.dtdns.com DtDNS will be ceasing operations on August 1, 2018.)
thank you and farewell #dtdns (https://t.co/1qwrlHIy1f DtDNS will be ceasing operations on August 1, 2018.)
— Tru Huynh (@huynh_tru) July 2, 2018
A DuckDuckGo search for "Dynamic DNS Service" led me to DYNU Systems, Inc. and their very gracious offer of free third level domain names. I promptly signed up for InfinitelyRemote.DYNU.net and soon found myself back in business.
The thing about these types of services is that you must have an always-on device on your network that can reach out to the DNS (domain name server) host and report what your current IP address is and if necessary record the change. This is done using "client" software which is readily available on the DYNU website. I already had a "home-brew" solution for keeping DtDNS up to date and was very pleased to find it just as suitable for use with the newly discovered DYNU.
Since I am hosting a 'mostly a website'™ from my home's network via a linux system I have the required address check/update client script running as a cron job (scheduled event) every 10 minutes. Basically here's how it works:
Using a "wget" command the script checks with http://DeBurger.com/myip to discover the currently assigned public IP address (as seen from the internet) of the network. This value is set for the IPADDR variable. The script then uses a "nslookup" command to see what DSNU.com name servers think my address should be. This value is set for the LASTIP variable. A comparison is then made and if IPADDR is equal to LASTIP then nothing changes and the script is put away for another ten minutes. If however, IPADDR is not equal to LASTIP then something has changed and DYNU must be informed so their information can be updated. Using a specially crafted web address and the "wget" command, this information is delivered to the DYNU system and the new address becomes associated with the domain name. This means - if all goes well - when my IP address changes it should never take longer than 10 minutes for this fact to be discovered and the needed correction made. (The script's activity is also written to a LOG file for good measure.
#!/bin/bash
#
rm -f myip*
#
wget -q www.deburger.com/myip
#
IPADDR=`/bin/grep "." myip | /bin/awk '{ print $1 }'`
#
LASTIP=`/usr/bin/nslookup -sil infinitelyremote.dynu.net ns1.dynu.com | /bin/grep -A1 infinitelyremote.dynu.net | /bin/grep Address: | /bin/awk '{ print $2 }'`
#
UPDATE="wget -O - http://api.dynu.com/nic/update?myip=$IPADDR&username=<MyUserName>&password=<MyPassword_MD5-hash>"
if [ "$IPADDR" != "$LASTIP" ]; then
$UPDATE
echo "`date` - Posted IP change from $LASTIP to $IPADDR" >> /usr/local/sbin/IP_basher_log
else
echo "`date` - IP still $IPADDR" >> /usr/local/sbin/IP_basher_log
fi
TLDR: There was precious little reporting about the demise of DtDNS so I thought I would help spread the news. I look forward to many years with DYNU and only hope if they decide to go away they might give a little more of a "heads-up" than we got from the other guy.