Njalla
From MikroTik Wiki
Script to update the Njalla Dynamic DNS from RouterOS.
# ___ ___
# ________ ___ ______ / / / / _____
# \ \ \__\_\___ \/ / / /_\___ \
# / \ / / / _ / /_/ // _ /
# / // /\/ / / / / / / /
# / __//__/ /\_______\____\___\_______\
# \/ \____/
#
# Njal.la Dynamic DNS v1.0
#
# This script requires these policies: read, policy, test.
#
# To add this to the scheduler, first add this script as "njalla", then use: /system scheduler add interval=5m name=njalla on-event=njalla policy=read,write,policy,test start-time=startup
#
# Configurable items here:
:local domain "<your-domain>"
:local key "<your-key>"
:local WANinterface "<your-wan-interface>"
# Leave the rest of the script as is.
:global NjallaIP
:local ipv4addr
:set ipv4addr [/ip address get [/ip address find interface="$WANinterface"] address]
:set ipv4addr [:pick [:tostr $ipv4addr] 0 [:find [:tostr $ipv4addr] "/"]]
:if ([:len $ipv4addr] = 0) do={
:log error ("Could not get IP for interface " . $WANinterface)
:error ("Could not get IP for interface " . $WANinterface)
}
:if ($ipv4addr != $NjallaIP) do={
:put "IPv4 address changed to $ipv4addr";
:set NjallaIP $ipv4addr;
:log info ("Updating dynamic IPv4 address to IP " . $ipv4addr)
/tool fetch check-certificate=no keep-result=no mode=https url="https://njal.la/update/?h=$domain&k=$key&a=$ipv4addr&quiet"
} else {
:log info ("Dynamic IPv4 address is still " . $ipv4addr)
}