di /system/scripts isi ini:
name :
Code:
dynDNS
Code:
centang smua (sebenernya si ga perlu smua, tp tes2 aja lg
Code:
:local ddnsuser "<ddns-username>" :local ddnspass "<ddns-password>" :local theinterface "<pppoe-interface>" :local ddnshost "<host.di.ddns.org>" :local ipddns [:resolve $ddnshost]; :local ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ] :if ([ :typeof $ipfresh ] = nil ) do={ :log info ("DynDNS: 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 ("DynDNS: IP-DynDNS = $ipddns") :log info ("DynDNS: IP-Fresh = $ipfresh") :log info "DynDNS: Update IP needed, Sending UPDATE...!" :local str "/nic/update?hostname=$ddnshost&myip=$ipfresh&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" /tool fetch address=members.dyndns.org src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/DynDNS.".$ddnshost) :delay 1 :local str [/file find name="DynDNS.$ddnshost"]; /file remove $str :global ipddns $ipfresh :log info "DynDNS: IP updated to $ipfresh!" } else={ :log info "DynDNS: No need to update"; } }
di terminal paste ini:
Code:
/system scheduler add name=dynDNS interval=00:01 on-event="/system script run dynDNS\r\n"
klo ada yg salah mohon dikoreksi, maklum masi belajar2 mikrotik jg
NB: gw pake mikrotik 4.5 klo ada yg error mungkin beda versi aja kli ya.
0 komentar:
Posting Komentar