-
-
Save luispaulorsl/5df801cd8b4e4dff4af1519a2d40da10 to your computer and use it in GitHub Desktop.
# No-IP DDNS Updater | |
# http://www.noip.com/integrate/ | |
:global publicIP; | |
:global abortUpdate; | |
:if ([:typeof $abortUpdate] != "bool") do={ | |
:set $abortUpdate false; | |
} | |
:if ($abortUpdate) do={ | |
:error "DDNS: Update aborted. Intervention required."; | |
} | |
:local currentIP; | |
:local targetInterface "<interface | auto>"; | |
:local ddnsUser "<username>"; | |
:local ddnsPass "<password>"; | |
:local ddnsHost "<hostname>"; | |
:local ddnsURL "http://dynupdate.no-ip.com/nic/update?hostname=$ddnsHost&myip=$currentIP"; | |
:if ($targetInterface = "auto") do={ | |
:local response [/tool fetch url="http://luispaulo.net/ip" as-value output=user]; | |
:if ($response->"status" = "finished") do={ | |
:set currentIP ($response->"data"); | |
} else={ | |
:set currentIP ""; | |
} | |
} else={ | |
:set currentIP [/ip address get [/ip address find interface=$targetInterface] address]; | |
:if ([:typeof $currentIP] = nil) do={ | |
:error "DDNS: No IP obtained."; | |
} else={ | |
:set $currentIP [:pick [:tostr $currentIP] 0 [:find [:tostr $currentIP] "/"]]; | |
} | |
} | |
:if ($currentIP != $publicIP) do={ | |
:local response [/tool fetch url=$ddnsURL user=$ddnsUser password=$ddnsPass as-value output=user]; | |
:if ($response->"status" = "finished") do={ | |
:local data ($response->"data"); | |
:set $abortUpdate (!([:pick $data 0 4] = "good" || [:pick $data 0 5] = "nochg")); | |
:set $publicIP $currentIP; | |
:log info "DDNS: Update succeeded." | |
} else={ | |
:log error "DDNS: Update failed."; | |
} | |
} else { | |
:log info "DDNS: No IP change."; | |
} |
Thanx
Thanks for the script - works well. But I've noticed that the log always shows updated succeeded, even if my IP didn't change since the previous update.
Hi, I can't get this to run on version v.6.49.4
Hi, I can't get this to run on version v.6.49.4
Interesting - I have it working on v6.49.5, except it always reports the IP as changed, even when it it's the same.
Did you update the targetInterface, username, password, and hostname?
It's not working with 7.x
any fix?
not working for me on 6.49.8
i dont get nothing in log and ip not updating
April 19, 2024
Still working for me, running firmware arm64-7.14.3 on an RB5009.
Also running it on an older RB2011 and an older RB951 with firmware mipsbe-6.49.14; working fine.
The script still always reports the IP was updated because it was changed, even when it hasn't changed... But it does actually update when the IP does change, and that's all that matters.
Beware that certain special characters in your NO-IP username/password may not work on a 'tik without first escaping ( \ ) them in pre-7.0 firmware. #https://wiki.mikrotik.com/wiki/Manual:Scripting#Constant_Escape_Sequences
It works, Thanks!