Skip to content

Instantly share code, notes, and snippets.

@jk0
Created October 1, 2012 17:22
Show Gist options
  • Select an option

  • Save jk0/3813155 to your computer and use it in GitHub Desktop.

Select an option

Save jk0/3813155 to your computer and use it in GitHub Desktop.
RouterOS DynDNS Script
: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