Script Auto Update IP Dinamic

This script was designed to utilize the No-IP Update API which offers direct access to No-IP’s DNS update system.

This script is based on the Dynamic DNS Update Script for changeip.com.

Tested to work on RouterOS MikroTik V. 4.xx , 5.xx dan 6.xx

/system script
add name=HomingBeacon policy=
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api
source=”# HomingBeacon Main Dynamic DNS Update Scriptr
n# Written by Sam Norris, ChangeIP.comr
n# 20100728 Tested on RouterOS 4.9r
n# 20110511 Tested on RouterOS 5.2r
nr
n# Set your specific ChangeIP.com preferences here.r
n:global ddnsuser “user.changeip.com“r
n:global ddnspass “password.changeip.com“r
n:global ddnshost “hostname.changeip.net“r
n# Change ddnsport to 8245 to bypass proxy.r
n:local ddnsport 80r
nr
n# Do not edit anything below this line.  You have been warned.r
n# Abusive updates to the system will cause firewall blocks.r
nr
n# Please be considerate andr
n# do not let this script run more than once per 3-5 minutes.r
nr
n:log info “DDNS: Starting.”r
nr
n# Initialize checkpointr
n:global ddnscheckpointr
n:if ([:typeof $ddnscheckpoint] = “time”) do={r
nt:log info (“DDNS: Last check was ” . ([/system clock get time] – $d
dnscheckpoint))r
n} else={r
nt:log info “DDNS: Cannot determine checkpoint, set now.”r
nt:global ddnscheckpoint ( [/system clock get time] – 1d )r
n}r
nr
n# Get the current IPr
n:if ([/system clock get time] – $ddnscheckpoint > [:totime 180s] || [/s
ystem clock get time] – $ddnscheckpoint < [:totime 0s]) do={r
n   :log info “DDNS: Performing remote IP detection.”r
n   /tool fetch address=”ip.changeip.com” host=”ip.changeip.com” src-
path=(“/?” . [/int eth get 0 mac-address ]) dst-path=”ip.changeip.com.
txt” mode=http port=$ddnsportr
n   :global ddnscheckpoint [/system clock get time]r
n} else={r
n   :log info “DDNS: Please be considerate and wait a few seconds longer
.”r
n   :breakr
n}r
nr
n# Parse the IP address received from fetch script.r
nt:global ddnslastipr
nt:local html [/file get “ip.changeip.com.txt” contents]r
nt:local ddnsip [:pick $html ([:find $html “<!–IPADDR=”] + 11) [:fi
nd $html “–>”] ]r
nr
n# Is it a valid IP and is it different than the last one?r
nt:if ([:typeof [:toip $ddnsip]] = “ip” AND $ddnsip != $ddnslastip
) do={r
ntt:log info “DDNS: Sending UPDATE with $ddnsip”r
ntt:log info [/tool dns-update name=$ddnshost address=$ddnsip key-nam
e=$ddnsuser key=$ddnspass ]r
ntt:global ddnslastip $ddnsipr
nt} else={r
ntt:log info “DDNS: No update required.”r
nt}r
n}r
n”

/system scheduler
add comment=”ChangeIP.com Dynamic DNS Update”
disabled=no
interval=5m name=DynamicDNS
on-event=HomingBeacon
policy=read,write start-time=startup

[sociallocker]

NOTE:
Replace the red writing with user and passwd you changeip.com following the host.

[/sociallocker]

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

~ HITS Radio Streaming ~