configuring mikrotik to update dnydns.com

I have viewed the scripts to update to dyndns.com

How do i resolve the ip address for dyndns.com? Dyndns.com does not provide a static ip.(I think).

Thanks,

The Script “dyndns-update”. Set the local variables username, password and hostname:

Code:

Set needed variables

:local username “dyndnsUsername”
:local password “dyndnsPassword”
:local hostname “hostname.dyndns.org

:global dyndnsForce
:global previousIP

print some debug info

:log info (“dyndns-update: username = $username”)
:log info (“dyndns-update: password = $password”)
:log info (“dyndns-update: hostname = $hostname”)
:log info (“dyndns-update: previousIP = $previousIP”)

get the current IP address from the internet (in case of double-nat)

/tool fetch mode=http address=“checkip.dyndns.org” src-path=“/” dst-path=“/dyndns.checkip.html”
:local result [/file get dyndns.checkip.html contents]

parse the current IP result

:local resultLen [:len $result]
:local startLoc [:find $result ": " -1]
:set startLoc ($startLoc + 2)
:local endLoc [:find $result “” -1]
:local currentIP [:pick $result $startLoc $endLoc]
:log info “dyndns-update: currentIP = $currentIP”

Determine if dyndns update is needed

more dyndns updater request details available at http://www.dyndns.com/developers/specs/syntax.html

:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce false
:set previousIP $currentIP
/tool fetch user=$username password=$password mode=http address=“members.dyndns.org” src-path=“/nic/update?hostname=$hostname&myip=$currentIP” dst-path=“/dyndns.txt”
:local result [/file get dyndns.txt contents]
:log info (“dyndns-update: Dyndns update needed”)
:log info ("dyndns-update: Dyndns Update Result: ".$result)
:put ("Dyndns Update Result: ".$result)
} else={
:log info (“dyndns-update: No dyndns update needed”)
}

Script “dyndns-force”. Intended to update dyndns only once every 24 hrs. If you run this too much, you may get locked out of dyndns.
Code:
:global dyndnsForce true
/system script run dyndns-update

Setup the schedulers. Run dyndns-update every 15 minutes and dyndns-force once every 24 hours:
Code:
/system scheduler add comment=“” disabled=no interval=15m name=dyndns-update on-event=
dyndns-update start-date=jan/01/1970 start-time=00:00:00
/system scheduler add comment=“” disabled=no interval=1d name=dyndns-force on-event=
dyndns-force start-date=jan/01/1970 start-time=02:00:00

When I get to the line:


:log info (“dyndns-update: username = $username”)
syntax error (line 1 column 40)

I get an error? What does the $username mean? The wiki says it is a substitution operator, so I assume we are substituting something for variable? Can you clarify? Thanks,

For anyone reading this thread, you need to edit the green for your specific dyndns user name, password and host name. There were a few syntax errors in the script above. Corrected it reads like this:

\

Set needed variables

:local username “dyndnsUsername”;
:local password “dyndnsPassword”;
:local hostname “hostname.dyndns.org”;

:global dyndnsForce;
:global previousIP;

print some debug info

:log info (“dyndns-update: username = $username”)
:log info (“dyndns-update: password = $password”)
:log info (“dyndns-update: hostname = $hostname”)
:log info (“dyndns-update: previousIP = $previousIP”)

get the current IP address from the internet (in case of double-nat)

/tool fetch mode=http address=“checkip.dyndns.org” src-path=“/” dst-pat>
:local result [/file get dyndns.checkip.html contents];

parse the current IP result

:local resultLen [:len $result];
:local startLoc [:find $result ": " -1];
:set startLoc ($startLoc + 2);
:local endLoc [:find $result “” -1];
:local currentIP [:pick $result $startLoc $endLoc];
:log info “dyndns-update: currentIP = $currentIP”

:local startLoc [:find $result ": " -1];
:set startLoc ($startLoc + 2);
:local endLoc [:find $result “” -1];
:local currentIP [:pick $result $startLoc $endLoc];
:log info “dyndns-update: currentIP = $currentIP”

Determine if dyndns update is needed

more dyndns updater request details available at http://www.dyndns.co>

:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce false;
:set previousIP $currentIP;
/tool fetch user=$username password=$password mode=http address="member>
:local result [/file get dyndns.txt contents];
:log info (“dyndns-update: Dyndns update needed”)
:log info ("dyndns-update: Dyndns Update Result: ".$result)
:put ("Dyndns Update Result: ".$result);
} else={
:log info (“dyndns-update: No dyndns update needed”)
}

Script “dyndns-force”. Intended to update dyndns only once every 24 hrs. If you run this too much, you may get locked out of dyndns.
Code:
:global dyndnsForce true;
/system script run dyndns-update