Setting up DDNS on Router

dbgarlisch

New Member
I run a personal, non-commercial webserver out of my home. It sits behind behind my DSL router firewall using port forwarding.

As a replacement for my no longer free subdomain hosted by dyndns, I am trying to reconfigure my router (Encore ENHWI-2AN3) to use DDNS on zoneedit. The router lists zoneedit as a supported provider.

Under dyndns, I created a dummy subdomain (e.g. subdom.dyndns.org) which I then attached to my router for DDNS update.

However, I am not seeing an option on your site for creating a subdomain (e.g. subdom.zoneedit.com). Can I do this? Does zonedit offer free subdomain DDNS service like dyndns used to provide?

The example DDNS video only uses an already existing domain name.

I appreciate any help you can offer.
Thanks!
 

Attachments

  • zonedit.png
    zonedit.png
    62.1 KB · Views: 4

sandy

Administrator
Staff member
Hi there

zoneedit requires that you have your own domain name for all of the services offered.

thanks
sandy
 

dbgarlisch

New Member
Thanks!

I was able to set up a subdomain on a hosting account I already had and pointed it to the ZoneEdit DNS servers by adding two NS records to my hosting account.

Then, i set up a cron job on the webserver running behind my firewall that periodically checks the DSL's IP address. If it changes, I push the new IP to ZE using curl and your web interface.

The cron script:
Code:
#!/bin/bash
logfile=/home/user/puship.log
txtfile=/home/user/curip.txt
host=sub.domain.net

# force file to exist
touch $txtfile

# get last known IP
oldip=`cat $txtfile`

# get current IP
curip=`curl -s ident.me`

tstamp=$(date +%D@%T)

if [ "$oldip" = "$curip" ] ; then
  echo "$tstamp  IP did not change $oldip"
else
  # save new IP
  echo $curip > $txtfile
  # push IP to ZoneEdit with user auth - quotes around URL required due to '&' char
  ret=`curl -s -u ZEUserName:ZEAuthToken "http://dynamic.zoneedit.com/auth/dynamic.html?host=$host&dnsto=$curip"`
  # log some stuff
  echo "$tstamp  IP changed from $oldip to $curip" >> $logfile
  echo "$tstamp    $ret" >> $logfile
  tail -n 2 $logfile
fi
 
Last edited:

dbgarlisch

New Member
I waited to reply to see if there were any problems. And there were!

With some minor script changes to improve error handling, it seems to be working just fine now.

Updated script:
Code:
#!/bin/bash
logfile=/home/user/puship.log
txtfile=/home/user/curip.txt
host=sub.domain.net
ippat='+([0-9]).+([0-9]).+([0-9]).+([0-9])'
successpat='\<SUCCESS*'

# force file to exist
touch $txtfile

# get last known IP
oldip=`cat $txtfile`

# get current IP
curip=`curl -s ident.me`

tstamp=$(date +%D@%T)

# need quotes to handle empty strings
if [ "$oldip" = "$curip" ] ; then
  echo "$tstamp  IP did not change $oldip" >> $logfile
  tail -n 1 $logfile
elif [[ $curip != $ippat ]] ; then
  # ident.me returned bad value
  echo "$tstamp  INVALID IP curip=$curip" >> $logfile
  tail -n 1 $logfile
else
  # push new IP to ZoneEdit
  ret=`curl -s -u ZEUserName:ZEAuthToken "http://dynamic.zoneedit.com/auth/dynamic.html?host=$host&dnsto=$curip"`
  echo "$tstamp  Changing IP from $oldip to $curip" >> $logfile
  echo "$tstamp    $ret" >> $logfile
  if [[ $ret == $successpat ]] ; then
    # push succeeded - cache the new ip
    echo $curip > $txtfile
    echo "$tstamp    Cached $curip to $txtfile" >> $logfile
    N=3
  else
    N=2
  fi
  # dump new log entries to console
  tail -n $N $logfile
fi
 

dbgarlisch

New Member
ZoneEdit apparently requires waiting 600 seconds between updates. So I switched the cron job to run every 15 minutes. Historically, my IP changes seem to happen on Sunday nights. I know the 15 minute check is over-kill, but I only do a push to ZE if I detect a change. This way I will have a max of 15 down time if a mid-week IP change occurs.

I added a ZE return value check pattern. I only update the IP cache file ($txtfile) if ZE returns SUCCESS.

Also, ident.me occasionally fails. I added an IP pattern check on the return value.
 
Top