add for mikrotik add for mikrotik

Argomento: add for mikrotik

Post add for mikrotik
di wesam alazade su lunedì 17 agosto 2015

how to add dns for mikrotik server

Rispondi con citazione | Segnalare
Post Re: add for mikrotik
di timothytw su martedì 18 agosto 2015

1) add a script called Dynu.

----------

:global ddnsuser "userdynu"
:global ddnspass "passdynu"
:global theinterface "lan name"
:global ddnshost "hostname"
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("dynu: No ip address on $theinterface .")
} else={
:for i from=( [:len $ipfresh] - 1) to=0 do={
:if ( [:pick $ipfresh $i] = "/") do={
:set ipfresh [:pick $ipfresh 0 $i];
}
}
:if ($ipddns != $ipfresh) do={
:log info ("dynu: IP-dynu = $ipddns")
:log info ("dynu: IP-Fresh = $ipfresh")
:log info "dynu: Update IP needed, Sending UPDATE...!"
:global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"
/tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
:delay 1
:global str [/file find name="Dynu.$ddnshost"];
/file remove $str
:global ipddns $ipfresh
:log info "dynu: IP updated to $ipfresh!"
} else={
:log info "dynu: dont need changes";
}
}
--------------

Please change the values in bold with your account details. Please note that your username can be found in 'Contact Details' section in Dynu control panel.

For more information, you may refer to our IP update protocol at https://www.dynu.com/Resources/API

2) After manually tested that it works, you can add a script to run the update every 5 minutes:

/system scheduler add comment="Update Dynu DDNS" disabled=no interval=5m \ name=Dynu on-event=Dynu policy=read,write,test

Rispondi con citazione | Segnalare
sabato 23 novembre 2024 09:32
Loading...