Mikrotik Duckdns.org Update (New Script)

In Mikrotik, Tutorial


Entah kenapa script untuk update Dynamic IP Public via Duckdns yang lama seperti dalam postinganku yang terdahulu “Duck DNS Update Script For Mikrotik” mendadak macet. Alhasil ketika akan me-remote router jarak jauh jadi gagal.

Supaya dapat kembali update Dynamic IP Public, silahkan gunakan script berikut ini, simple dan ada penambahan record IP Public ke address list, untuk rule redirect IP.

# DuckDNS Full Domain (FQDN)
:local duckdnsFullDomain "subdomain.duckdns.org"

# DuckDNS Sub Domain
:local duckdnsSubDomain "subdomain"

# DuckDNS Token
:local duckdnsToken "12345678-aaaa-bbbb-cccc-1234567890aa"

# The interface name with the assigned dynamic IP address (usually the WAN interface).
:local wanInterface "Ether0-Gateway"

# Log destination
:local logDestination "/disk1/logs/"

#-------------------------------------------------------------------------------------------------------------------------

:log warning message="START: DuckDNS.org DDNS Update"

:if ([/interface get $wanInterface value-name=running] = true) do={

#   Get the previous IP via DNS resolution.
    :local previousIP [:resolve "$duckdnsFullDomain"]
    /ip firewall address-list remove [find where comment="public"]

#   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 "DuckDNS: DNS IP ($previousIP), interface IP ($currentIP)"
    
    :if ($currentIP != $previousIP) do={
        :log info "DuckDNS: Current IP $currentIP is not equal to previous IP, update needed"
        :log info "DuckDNS: Sending update for $hostname"
        /tool fetch mode=https keep-result=yes dst-path=($logDestination . "duckdns-ddns-update.txt") address=[:resolve www.duckdns.org] port=443 host=www.duckdns.org src-path=("/update?domains=" . $duckdnsSubDomain . "&token=" . $duckdnsToken . "&ip=" . $currentIP);
        /ip firewall address-list add list=public address="$currentIP"  comment=public
        :log info "DuckDNS: Host $hostname updated on DuckDNS with IP $currentIP"
    }   else={
        :log info "DuckDNS: Previous IP $previousIP is equal to current IP, no update needed"
        /ip firewall address-list add list=public address="$previousIP"  comment=public
        }

}   else={
    :log info "DuckDNS: $wanInterface is not currently running, unable to verify and/or update IP."
    }
    
:log warning message="END: DuckDNS.org DDNS Update"

Related Search

Tags: #duckdns #dynamic ip public #ip public #mikrotik

Anda sedang membaca artikel tentang Mikrotik Duckdns.org Update (New Script). Silahkan baca artikel Be Log tentang Mikrotik, Tutorial lainnya. Semoga bermanfaat ...

Mengatasi Stiker Whatsapp Yang Tidak Muncul Di Android
Mengatasi Stiker Whatsapp Yang Tidak Muncul Di Android
Wahtsapp baru-baru ini merelease stiker untuk penggunanya,
SSL Gratis Dari LetsEncrypt
SSL Gratis Dari LetsEncrypt
Untuk mendapatkan SSL Ceritificate mungkin tidaklah semurah
Setup Storage Path The Dude di RB750G r3
Setup Storage Path The Dude di RB750G r3
The Dude merupakan tool yang cukup penting
Install Teamviewer via Terminal di Ubuntu 18.04 Bionic Beaver
Install Teamviewer via Terminal di Ubuntu 18.04 Bionic Beaver
Aku coba install Teamviewer menggunakan GUI tapi

Top