Created
October 1, 2012 17:22
-
-
Save jk0/3813155 to your computer and use it in GitHub Desktop.
RouterOS DynDNS Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :local username "username" | |
| :local password "password" | |
| :local hostname "hostname" | |
| :global forceUpdate | |
| :global previousIP | |
| :local currentIP [/ip address get [find interface="ether1-gateway"] address]; | |
| :for i from=([:len $currentIP] - 1) to=0 do={ | |
| :if ([:pick $currentIP $i] = "/") do={ | |
| :set currentIP [:pick $currentIP 0 $i] | |
| } | |
| } | |
| #:set forceUpdate true | |
| :if (($currentIP != $previousIP) || ($forceUpdate = true)) do={ | |
| :set forceUpdate false | |
| :set previousIP $currentIP | |
| /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" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment