NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

InterClaw's avatar
InterClaw
Aspirant
Apr 09, 2014

DNS-O-Matic addon call to server not working?

So DynDNS Free is shutting down and my router doesn't support any other service. Bummer. Found the DNS-O-Matic addon for ReadyNAS. But I can't get it working.

I believe there is something wrong with the call to the dnsomatic server. The addon logfile shows entries like this:

Wed Apr 9 23:20:01 CEST 2014 : Running 3 23:20 123.456.789.123
Wed Apr 9 23:20:01 CEST 2014 : found: 123.456.789.123 cached IP:
Wed Apr 9 23:20:01 CEST 2014 : found: 123.456.789.123 cached IP:
Wed Apr 9 23:20:01 CEST 2014 : Return message of DNS-O-Matic :

(Fake IP above of course.)

It seems cURL is having problems with the request and what to do with the result. So nothing is returned, or is returned to late, or it's not saved in the variable, or something, I don't know... Consequently, the cached IP is never set either in that temp file. That file only contains a blank row it seems.

Here's what the request looks like in the script:

RETURN=$(`which curl` -k -s https://${USER}:${PASS}@updates.dnsomatic.com/nic/update?hostname=${HOSTNAME}&myip=$IP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG)

I noticed that myip=$IP looked different and tried myip=${IP}, but that didn't help. I still think there might be something wrong with the myip parameter and how cURL interprets it. I'm also not sure what `which curl` means... Not very good at this sort of thing. :) Anyway, this is what I think the command would become:

curl -k -s https://myusername:mypassword@updates.dnsomatic.com/nic/update?hostname=all.dnsomatic.com&myip=123.456.789.123&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG

If I try the same URL the script builds above in Chrome it works and I can set the new IP that way. So I don't know why cURL and this script can't do it. Can anyone help?



Oh, and here's the whole script for your convenience:

#!/bin/bash
HOSTNAME="all.dnsomatic.com"
USER="myusername"
PASS="mypassword"
TMPFILE="/tmp/oldip.DNS-O-Matic"
LOGFILE="/var/log/DNS-O-Matic.log"
DATENOW=$(date)
DEBUG="Yes"
TIME=$(date +%R)
DOW=$(date +%w)

if [ $PASS = "password" ]; then
exit 0
fi

IP=$(`which curl` -s http://myip.dnsomatic.com/)
#IP=$(/usr/local/bin/curl -s http://myip.dnsomatic.com/)
#IP=$(curl -s http://myip.dk/ | egrep -m1 -o '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}')

if [ $DEBUG = "Yes" ]; then
echo $DATENOW ": Running" $DOW $TIME $IP>> $LOGFILE
fi

if [[ -z $IP ]]; then
echo $DATENOW ": NO Internet IP : exiting" >> $LOGFILE
exit 0
fi

if [ -r "/tmp/oldip.DNS-O-Matic" ]; then
OLDIP=`cat /tmp/oldip.DNS-O-Matic`

if [ $DEBUG = "Yes" ]; then
echo $DATENOW ": found:" $IP " cached IP:" $OLDIP >> $LOGFILE
fi

if [ $DOW = "1" ];then
if [ $TIME = "01:00" ]; then
echo $DATENOW ": Resetting IP" $TIME >> $LOGFILE
OLDIP=""
fi
fi

if [ "$OLDIP" = "$IP" ]; then
exit 0
else
echo $DATENOW ": found:" $IP " cached IP:" $OLDIP >> $LOGFILE

RETURN=$(`which curl` -k -s https://${USER}:${PASS}@updates.dnsomatic.com/nic/update?hostname=${HOSTNAME}&myip=$IP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG)

echo $DATENOW ": Return message of DNS-O-Matic : " $RETURN >> $LOGFILE
echo $RETURN | grep "good" > /dev/null 2>&1

if [ "$?" -eq "0" ]; then
echo $IP > /tmp/oldip.DNS-O-Matic
else
echo "" > /tmp/oldip.DNS-O-Matic
fi
fi
else
touch /tmp/oldip.DNS-O-Matic
fi

2 Replies

Replies have been turned off for this discussion
  • I was previously using dnsomatic, but I think that service was going non-free as well. I've switched to noip.com. I've also since upgraded to ROS6, which as a No-IP addon. Not sure if such an addon exists for 4.2.
  • I actually intend to use noip.com through dnsomatic, since I already use noip.com a bit. The service works (through Chrome) and is free. Would be nice if I could get it to work on the Pro though. :)

    I never found any other add-on to do this update. And messing with the router is not an option for me.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More