Skip to content

Instantly share code, notes, and snippets.

@soffchen
Last active June 24, 2016 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soffchen/4ca6f81b6dce20f88ba3dcda4065ce9d to your computer and use it in GitHub Desktop.
Save soffchen/4ca6f81b6dce20f88ba3dcda4065ce9d to your computer and use it in GitHub Desktop.
Duckdns script for RouterOS
:global currentIP;
:local newIP [/ip address get [find interface="cnc"] address];
:local newIP [:pick $newIP 0 [:find $newIP "/"]];
:if ($newIP != $currentIP) do={
:log info "IP address $currentIP changed to $newIP";
:set currentIP $newIP;
/tool fetch mode=https url="https://www.duckdns.org/update?domains=xxx&token=xxx&ip=$newIP" dst-path=duckdns.txt;
:local result [/file get duckdns.txt contents];
:log info "Duck DNS update result: $result";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment