:global ddnsuser "seuusuario"
:global ddnspass "suasenha"
:global ddnshost "seudominioddns.changeip.com"
:global ddnsinterface "InterfaceParaPegarIP"
#=======================================#
:global ddnssystem ("mt-" . [/system package get [/system package find name=system] version] )
:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
:global ddnslastip
:if ([:len [/interface find name=$ddnsinterface]] = 0 ) do={ :log info "DDNS: Interface nao existe $ddnsinterface, verifique." }
:if ([ :typeof $ddnslastip ] = "nothing" ) do={ :global ddnslastip 0.0.0.0/0 }
:if ([ :typeof $ddnsip ] = "nothing" ) do={
:log info ("DDNS: Nenhum IP presente na interface " . $ddnsinterface . ", verifique.")
} else={
:if ($ddnsip != $ddnslastip) do={
:log info "DDNS: Enviando atualizacao!"
:log info [
ut [/tool dns-update name=$ddnshost address=[
ick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ]
:global ddnslastip $ddnsip
} else={
:log info "DDNS: Atualizacao desnecessaria."
}
}