This script is based from different resources that I have combined to reach my goal.
Change the values of the first 3 variables with your proper configuration.
# No-IP automatic Dynamic DNS update
#--------------- Change Values in this section to match your setup ------------------
# No-IP User account info
:local noipuser "no-ipUsername"
:local noippass "password"
# 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 noiphost "myhost.ddns.net"
#------------------------------------------------------------------------------------
# No more changes need
/tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=mypublicip.txt
local ip [file get mypublicip.txt contents ]
put $ip
# The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
:local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$ip"
:local noiphostarray
:set noiphostarray [:toarray $noiphost]
:foreach host in=$noiphostarray do={
:log info "No-IP: Sending update for $host"
/tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=("no-ip_ddns_update-" . $host . ".txt")
:log info "No-IP: Host $host updated on No-IP with IP $ip"
}
Credits:c0d3rSh3ll from Mikrotik forum.
Mikrotik Wiki page
Nessun commento:
Posta un commento
Mi raccomando, non costringermi a censurare il tuo commento, perciò sii educato!