Skip to content

Instantly share code, notes, and snippets.

@ishrakr
Last active July 23, 2018 21:01
Show Gist options
  • Save ishrakr/77d38b9e6dbdfbdad44fa9c11660b357 to your computer and use it in GitHub Desktop.
Save ishrakr/77d38b9e6dbdfbdad44fa9c11660b357 to your computer and use it in GitHub Desktop.
:local Token "your-token"
:local Domain "subdomain"
:local WanInterface "ether1"
:global PreviousIP
:global ExternalIP
:log info ("DuckDNS: Checking IP")
:local CurrentIP [/ip address get [/ip address find interface=$WanInterface ] address];
:set ExternalIP [:pick $CurrentIP 0 [:find $CurrentIP "/"]];
:if ($ExternalIP != $PreviousIP) do={
:set PreviousIP $ExternalIP
/tool fetch mode=https url="https://www.duckdns.org/update?domains=$Domain&token=$Token&ip=$ExternalIP" keep-result=no
:log info ("DuckDNS: IP updated to $ExternalIP")
} else={
:log info ("DuckDNS: IP not changed")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment