Network
Dynu DDNS IP Updater — 7
Compares the IP of your WAN interface with the IP of your Dynu hostname and updates Dynu when they differ. Run it from the Scheduler (e.g. every 5 minutes).
RouterOS 7
# EN: Dynu account username | AR: اسم مستخدم حساب Dynu
:local ddnsuser "change here";
# EN: Dynu account password (or IP Update Password) | AR: كلمة مرور Dynu (أو IP Update Password)
:local ddnspass "change here";
# EN: Name of the WAN interface that holds your public IP | AR: اسم واجهة الإنترنت التي تحمل الـ IP العام
:local theinterface "change here";
# EN: Your Dynu hostname, e.g. example.ddnsfree.com | AR: اسم المضيف في Dynu
:local ddnshost "change here";
# EN: Safety check | AR: حماية من عدم تعديل المتغيرات
:if ($ddnsuser = "change here" || $ddnspass = "change here" || $theinterface = "change here" || $ddnshost = "change here") do={ :error "Edit the variables first" }
# EN: IP currently registered in DNS (empty if it cannot be resolved) | AR: الـ IP المسجل حالياً في DNS
:local ipddns "";
:do { :set ipddns [:resolve $ddnshost] } on-error={ :log warning "dynu: cannot resolve host" }
# EN: Current IP of the WAN interface | AR: الـ IP الحالي لواجهة الإنترنت
:local ipfresh "";
:do { :set ipfresh [/ip address get [/ip address find interface=$theinterface] address] } on-error={ :log warning "dynu: no ip address on interface" }
:if ($ipfresh = "") do={ :error "dynu: no ip address on interface" }
# EN: Remove the /mask part (1.2.3.4/24 -> 1.2.3.4) | AR: حذف جزء القناع (/24)
:set ipfresh [:pick $ipfresh 0 [:find $ipfresh "/"]];
:if ($ipddns != $ipfresh) do={
:log info ("dynu: DNS IP = $ipddns, WAN IP = $ipfresh, updating...");
:local url ("https://api.dynu.com/nic/update?hostname=" . $ddnshost . "&myip=" . $ipfresh);
# EN: v7 uses url= (address/src-path/mode are the old v6 syntax); keep-result=no means no file is saved
# AR: في v7 نستخدم url= (الصياغة القديمة address/src-path/mode خاصة بـ v6) و keep-result=no لعدم حفظ ملف
/tool fetch url=$url user=$ddnsuser password=$ddnspass keep-result=no;
:log info ("dynu: IP updated to $ipfresh");
} else={
:log info "dynu: no changes needed";
}