Kamis, 15 Juni 2017

Script IP-Dynamic (DDNS Telkom Indihome) Mikrotik OS.6

Alhamdulilah Telkom menjalin dan mengeluarkan produk terbaru yakni IP DDNS ( Dynamic Domain Name Services), fungsinya tiada lain membantu untuk penterjemah Ip Dinamis Internet di Indihome

Tutorial yang saya pelajari dari pencarian google, sedikit saya copas dan saya ubah disesuaikan dengan otorisasi pemakaian.

Scriptnya sebagai berikut,
Login Winbox Mikrotik, System-Script lalu copas code dibawah ini :

DDNS yang saya gunakan adalah bundling dengan Telkom Indihome melalui paket Pro sebesar Rp15.000
Saya beri nama ip-dynamic.

:global ddnsuser "UsernameAnda"
:global ddnspass "PasswordAnda"
:global theinterface "Ether1"
:global ddnshost anda.ip-dynamic.net
: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 ("IP-DYNAMICDNS: IP-DYNAMICDNS = $ipddns")
    :log info ("IP-DYNAMICDNS: IP-Fresh = $ipfresh")
   :log info "IP-DYNAMICDNS: Update IP needed, Sending UPDATE...!"
   :global str "/nic/update\?hostname=$ddnshost&myip=$ipfresh&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
   /tool fetch address=ip-dynamic.com src-path=$str mode=http user=$ddnsuser \
         password=$ddnspass dst-path=("/IP-DYNAMICDNS.".$ddnshost)
    :delay 1
    :global str [/file find name="IP-DYNAMICDNS.$ddnshost"];
    /file remove $str
    :global ipddns $ipfresh
  :log info "IP-DYNAMICDNS: IP updated to $ipfresh!"

    } else={
     :log info "IP-DYNAMICDNS: dont need changes";

    }
}

Sudah terbukti berjalan 100%

Semoga bermanfaat

Tidak ada komentar:

Posting Komentar