DDNS noip pada Mikrotik

DDNS (Dynamic DNS) merupakan sebuah tools saat kita menggunakan IP Public dynamic pada sebuah perangkat sehingga dapat diakses dengan name tanpa perlu tau saat ini IP-nya berapa.

noip.com adalah salah satu penyedia service DDNS yang cukup populer.

Saat ini saya memiliki sebuah router Mikrotik yang terhubung dengan jaringan salah satu provider internet lokal, dan mendapatkan IP Public Dynamic. IP Public Dynamic ini selalu berubah-ubah setiap waktu tergantung dari provider sehingga saya gunakan DDNS untuk mengakses router mikrotik tanpa perlu mengecek IP Public-nya.

berikut bagaimana menambahkan DDNS noip ke dalam Mikrotik:

  • Buka Winbox dari Mikrotik.
Gambar 1. Winbox – Mikrotik
  • buka script untuk noip pada mikrotik. Pilih System, kemudian script.
Gambar 2. menu script
  • Tambahkan script dengan klik tombol “+”
Gambar 3. Script List

tambahkan script berikut dengan disesuaikan username, password serta ddns name.

No-IP automatic Dynamic DNS update
———————————————-MODIFY THIS SECTION AS NEEDED———————————————-
No-IP account credentials.
:local noipUsername “Username Noip
:local noipPassword “Password Noip
Set the hostname or label of network to be updated.
Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.
To specify multiple hosts, separate them with commas.
:local noipHostname “DDNSname.ddns.net
The interface name with the assigned dynamic IP address (usually the WAN interface).
:local wanInterface “WAN Interface
Log destination
:local logDestination “/disk1/logs/”
————————————————————————————————————————-
:log warning message=”START: No-IP DDNS Update”
:if ([/interface get $wanInterface value-name=running] = true) do={
Get the previous IP via DNS resolution.
:local previousIP [:resolve "$noipHostname"]
Get the current IP on the WAN interface.
:local currentIP [/ip address get [find interface="$wanInterface" disabled=no] address]
Strip net mask from IP address.
:for i from=([:len $currentIP] - 1) to=0 do={ :if ([:pick $currentIP $i] = "/") do={ :set currentIP [:pick $currentIP 0 $i] } } :log info "No-IP: DNS IP ($previousIP), interface IP ($currentIP)" :if ($currentIP != $previousIP) do={ :log info "No-IP: Current IP $currentIP is not equal to previous IP, update needed"
The update URL. The “\3F” is hex for question mark (?). This is required since ? is a special character in the command.
:local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP" :local noipHostnames :set noipHostnames [:toarray $noipHostname] :foreach hostname in=$noipHostnames do={ :log info "No-IP: Sending update for $hostname" /tool fetch url=($url . "&hostname=$hostname") user=$noipUsername password=$noipPassword mode=http dst-path=($logDestination . "no-ip_ddns_update-" . $hostname . ".txt") :log info "No-IP: Host $hostname updated on No-IP with IP $currentIP" } } else={ :log info "No-IP: Previous IP $previousIP is equal to current IP, no update needed" }
} else={
:log info “No-IP: $wanInterface is not currently running, unable to verify and/or update IP.”
}
:log warning message=”END: No-IP DDNS Update”

reference : https://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_No-IP_DNS
  • Masukkan Script diatas ke dalam dialog box script dengan option seperti dibawah.
Gambar 4. DDNS noip update script

untuk memastikan bahwa script tersebut running dengan baik kita dapat tes dengan pilih button Run Script. dan kita lihat hasilnya pada Log. berikut contoh log jika kita running script diatas.

Gambar 5. Logs
  • Menambahkan schedule agar script update ddns noip tersebut update setiap waktu. Pilih System, Scheduler.
Gambar 6. Menu Scheduler.
  • Menambahkan schedule berikut,
Gambar 7. DDNS Noip Update Schedule

Berikut sekian bagaimana cara menambahkan DDNS noip ke dalam Mikrotik.

Leave a Reply

Your email address will not be published.