Jumat, 24 Januari 2014
Script DDNS MikrotikV6.0 dan Schedulernya
Berikut scripnya ,beri nama ddns-update :
:global ddnsuser "login email_no-ip.com"
:global ddnspass "password-no-ip.com"
:global theinterface "ether-pppoe"
:global ddnshost yourdomain.no-ip.com
:global ipddns [:resolve $ddnshost];
:global 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...!"
:global str "http://username:password@dynupdate.no-ip.com/nic/update?hostname=yourdomain.no-ip.com&myip=$ipfresh&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
/tool fetch address=dynupdate.no-ip.com src-path=$str mode=http user=$ddnsuser \
password=$ddnspass dst-path=("/DynDNS.".$ddnshost)
:delay 1
:global str [/file find name="DynDNS.$ddnshost"];
/file remove $str
:global ipddns $ipfresh
:log info "DynDNS: IP updated to $ipfresh!"
} else={
:log info "DynDNS: dont need changes";
}
}
kemudian script schedulernya beri nama scheduler-ddns-update
/system scheduler
add interval=1m name=ddns-update on-event=ddns-update policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api start-time=startup
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar