Skip to content

Instantly share code, notes, and snippets.

@anviar
Created May 6, 2018 18:47
Show Gist options
  • Save anviar/6050262539c950999813a0919eba9846 to your computer and use it in GitHub Desktop.
Save anviar/6050262539c950999813a0919eba9846 to your computer and use it in GitHub Desktop.
Microtik no-ip update script. Require read and write permissions
:local NOIPUser "username"
:local NOIPPass "serRetPasswwwwoD"
:local NOIPDomain "example.com"
:local WANInter [/interface get [ find type=pppoe-out running] name ]
:local IpCurrent [/ip address get [ find interface=$WANInter ] address ]
:local NOIPaddr [:resolve $NOIPDomain]
:for i from=( [:len $IpCurrent] - 1) to=0 do={
:if ( [:pick $IpCurrent $i] = "/") do={
:local NewIP [:pick $IpCurrent 0 $i]
:if ( $NOIPaddr != $NewIP ) do={
/tool fetch mode=http user=$NOIPUser password=$NOIPPass url="http://dynupdate.no-ip.com/nic/update\3Fhostname=$NOIPDomain&myip=$NewIP" keep-result=no;
:log info "NO-IP Update $NewIP";
}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment