User Tools

Site Tools


networking:router:mikrotik_dyndns

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking:router:mikrotik_dyndns [2013/09/26 21:49]
gcooper
networking:router:mikrotik_dyndns [2022/10/24 09:34] (current)
gcooper
Line 1: Line 1:
 ====== Mikrotik RouterOS Dynamic DNS ====== ====== Mikrotik RouterOS Dynamic DNS ======
  
-http://wiki.mikrotik.com/wiki/Scripts+===== Mikrotik Cloud Method =====
  
-http://forum.mikrotik.com/viewtopic.php?p=171805+http://wiki.mikrotik.com/wiki/Manual:IP/Cloud
  
-  - Add a script +  * Super simple to enable and no configuration required 
-  - Add a scheduler entry to run the script+  * Also supports NTP without configuring the SNTP Client
  
-:!: For some reason, this script wouldn't import via the CLI.  I had to copy and paste it into Winbox+Dynamic DNS and NTP service that's simple to set up and needs no scripts or scheduled tasks.  The only obvious down side is that the host name is not memorable.
  
-<file> +To make a more memorable hostname, you can create a CNAME record in another DNS domain name that you control using this DNS Name as the target.
-# Set needed variables +
-:local username "sonoracomm" +
-:local password "105700" +
-:local hostname "gcooper.dynalias.org"+
  
-:global dyndnsForce "" +==== Winbox ====
-:global previousIP "$previousIP"+
  
-# print some debug info +**IP -> Cloud**
-:log info ("UpdateDynDNS: username = $username"+
-:log info ("UpdateDynDNS: password = $password"+
-:log info ("UpdateDynDNS: hostname = $hostname"+
-:log info ("UpdateDynDNS: previousIP = $previousIP")+
  
-# get the current IP address from the internet (in case of double-nat) +  * Enable DDNS 
-/tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dyndns.checkip.html" +  * Enable Update Time
-:delay 1 +
-:local result [/file get dyndns.checkip.html contents]+
  
-# parse the current IP result +==== CLI ====
-:local resultLen [:len $result] +
-:local startLoc [:find $result ": " -1] +
-:set startLoc ($startLoc + 2) +
-:local endLoc [:find $result "</body>" -1] +
-:local currentIP [:pick $result $startLoc $endLoc] +
-:log info "UpdateDynDNS: currentIP $currentIP"+
  
-# Remove the # on next line to force an update every single time - useful for debugging, +<file> 
-# but you could end up getting blacklisted by DynDNS! +/ip cloud set enabled=yes update-time=yes
- +
-#:set dyndnsForce true +
- +
-# Determine if dyndns update is needed +
-# more dyndns updater request details http://www.dyndns.com/developers/specs/syntax.html+
  
-:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={ +/ip cloud print
-:set dyndnsForce false +
-:set previousIP $currentIP +
-:log info "$currentIP or $previousIP" +
-/tool fetch user=$username password=$password mode=http address="members.dyndns.org"+
-src-path="nic/update?system=dyndns&hostname=$hostname&myip=$currentIP&wildcard=no"+
-dst-path="/dyndns.txt" +
-:delay 1 +
-:local result [/file get dyndns.txt contents] +
-:log info ("UpdateDynDNS: Dyndns update needed"+
-:log info ("UpdateDynDNS: Dyndns Update Result: ".$result) +
-:put ("Dyndns Update Result: ".$result) +
-#/tool e-mail send from=email@gmail.com server=173.194.77.108 to=me@gmail.com subject="Current IP is $currentIP" +
-#:log info "Email of new IP address sent" +
-} else={ +
-:log info ("UpdateDynDNS: No dyndns update needed"+
-}+
 </file> </file>
networking/router/mikrotik_dyndns.1380253795.txt.gz · Last modified: 2013/09/26 21:49 by gcooper