##############Script Settings##################
:local NOIPUser "WriteHereName"
:local NOIPPass "WriteHerePassword"
:local WANInter "WriteHereWanInterfaceName"
###############################################
:local NOIPDomain "$NOIPUser.no-ip.biz"
:local IpCurrent [/ip address get [find interface=$WANInter] address];
:for i from=( [:len $IpCurrent] - 1) to=0 do={
:if ( [:pick $IpCurrent $i] = "/") do={
:local NewIP [:pick $IpCurrent 0 $i];
:if ([:resolve $NOIPDomain] != $NewIP) do={
/tool fetch mode=http user=$NOIPUser password=$NOIPPass url="http://dynupdate.no-ip.com/nic/update\3Fhostname=$NOIPDomain&myip=$NewIP" keep-result=no
:log info "NO-IP Update: $NOIPDomain - $NewIP"
}
}
}
##############Script Settings##################
:local NOIPUser "WriteHereName"
:local NOIPPass "WriteHerePassword"
:local WANInter "WriteHereWanInterfaceName"
###############################################
:local NOIPDomain "$NOIPUser.no-ip.biz"
:local IpCurrent [/ip address get [find interface=$WANInter] address];
:for i from=( [:len $IpCurrent] - 1) to=0 do={
:if ( [:pick $IpCurrent $i] = "/") do={
:local NewIP [:pick $IpCurrent 0 $i];
/tool fetch mode=http user=$NOIPUser password=$NOIPPass url="http://dynupdate.no-ip.com/nic/update\3Fhostname=$NOIPDomain&myip=192.168.1.1" keep-result=no
:log info "FAKE NO-IP Update: Done! $NOIPDomain - 192.168.1.1"
}
}
The fake ip makes that you do not need to visit their re-activation page?Because of free-account and rarely changing ip-address I would have to visit a no-ip site every twenty days.
Otherwise the account will be blocked.
But I made a second script. It sends fake-ip-address (192.168.1.1) every sunday in 01:15am.
Now I can forget about the inconvenience.
I use name "pppoe2-isp2"By :local WANInter "WriteHereWanInterfaceName"
What name must i set there? the name from ether1 for example?
exactly.The fake ip makes that you do not need to visit their re-activation page?
:global AfraidUser "user_name"
:global AfraidPass "password"
:global WANInter "interface_name"
:global AfraidDomain "domain_name"
:global IpCurrent [/ip address get [find interface=$WANInter] address];
:for i from=( [:len $IpCurrent] - 1) to=0 do={
:if ( [:pick $IpCurrent $i] = "/") do={
:global NewIP [:pick $IpCurrent 0 $i];
:if ([:resolve $AfraidDomain] != $NewIP) do={
/tool fetch mode=http url="fetchable_URL_goes_here" keep-result=no
:log info "Afraid.org Update: $AfraidDomain - $NewIP"
} else={
:log info "Afraid.org: don't need updates";
}
}
}
############## Script FreeDNS.afraid.org ##################
############## PARSER EDITION ##################
############## CREATED LESHIY_ODESSA ##################
# Specify the "Direct URL", which is https://freedns.afraid.org/dynamic/
# If RouterOS version 5.xx, then remove from the URL encryption - "https" change this to "http". Also see below.
# In front of the sign "?" put a backslash "\".
:global "direct-url" "http://freedns.afraid.org/dynamic/update.php\?dedC0TirYibYdzBYnnhVRiJJb8Q6iDY1Mji3mQ=="
# Specify the URL API "ASCII"
# Log in under your account and open the page https://freedns.afraid.org/api/
# Then copy the URL of your site - Available API Interfaces : ASCII (!!! NOT XML !!!)
# ATTENTION!!!! Before the question mark, put a backslash "\".
# If RouterOS version 5.xx, then remove from the URL encryption - "https" change this to "http".
:global "api-url" "http://freedns.afraid.org/api/\?action=getdyndns&sha=62egb6606ci46cbe6eo8iga61de6ia101858a08n"
# Specify your domain or subdomain.
:global "dns-domain" "name.com"
# Define variables for the external (WAN) interface
# Case sensitive.
:global "out-interface" "pppoe"
# !!!!!!!!!!!!!!!!! Nothing more do not need to edit!!!!!!!!!!!!!!!!!
# Check whether the file with the IP domain - freedns.txt
:if ([:len [/file find name=freedns.txt]] > 0) do={
} else={
/tool fetch url=$"api-url" dst-path="/freedns.txt"
}
# Find out the IP address of the domain using the API and parsing.
# Split the file
:local "result" [/file get freedns.txt contents]
:local "startloc" ([:find $"result" $"dns-domain"] + ([:len $"dns-domain"] + 1))
:local "endloc" ([:find $"result" $"direct-url" -1] -1)
:global "dns-domain-ip" [:pick $"result" $"startloc" $"endloc"]
# Find the current IP address on the external interface
:global "current-ip" [/ip address get [find interface=$"out-interface"] address]
# Obtained from IP addresses to be excluded subnet mask
:set "current-ip" [:pick $"current-ip" 0 ([:len $"current-ip"]-3) ]
# Compare the external IP with the IP address of the DNS domain.
:if ($"current-ip" != $"dns-domain-ip") do={
# If different, then sent to freedns.afraid.org our external IP by using Direct URL
:log info ("Service Dynamic DNS: old IP address $"dns-domain-ip" for $"dns-domain" CHANGED to -> $"current-ip"")
/tool fetch url=$"direct-url" keep-result=no
# Download the file with the new IP after 5 sec.
:delay 5
/tool fetch url=$"api-url" dst-path="/freedns.txt"
} else={
# Not to clog the log, you need to comment out this line.
:log info ("IP address is NOT CHANGED, the update is not required")
}
# Since version RouterOS version 6.0rc12 supported encryption /tool fetch mode=https
# In :global "direct-url" need to change to httpS://
# For RouterOS version 6.xx
# /tool fetch mode=https url=$"direct url"
# :global "direct-url" "https://freedns.afraid.org/dynamic/update.php\?UVdjU2lzQmQwSkdjZW9aWkNleTdJdXFtOjg2NTI0NzE="
# http://wiki.mikrotik.com/wiki/Manual:Scripting
# http://wiki.mikrotik.com/wiki/Manual:Scripting-examples
# http://wiki.mikrotik.com/wiki/Manual:Tools/Fetch
# http://forum.ixbt.com/topic.cgi?id=14:60498-86#2373
##############Script FreeDNS.afraid.org##################
/system scheduler
add disabled=no interval=1m name=freedns.afraid.org on-event="/system script run freedns.afraid.org" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api start-time=startup
I have had problems getting scripts onto the router, I have version 5.26 and everything so far has failed. Does the web console work for this, or would it be better to SSH in (in which case, best way to edit?)?Hello
Sorry, I do not know English and therefore I use the translator.
I wrote my own script for freedns.afraid.org
The most important thing!!! The script works if you have multiple domains.
Code: Select all############## Script FreeDNS.afraid.org ################## ############## PARSER EDITION ################## ############## CREATED LESHIY_ODESSA ##################
Use WinBox to create the script.
I have had problems getting scripts onto the router, I have version 5.26 and everything so far has failed. Does the web console work for this, or would it be better to SSH in (in which case, best way to edit?)?
Does it run at startup or as timed event? What permissions does it require?
/system scheduler add disabled=no interval=1m name=freedns.afraid.org on-event=\ "/system script run freedns.afraid.org" policy=\ ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \ start-time=startup
Thanks, works fine for me.Hello
Sorry, I do not know English and therefore I use the translator.
I wrote my own script for freedns.afraid.org
The most important thing!!! The script works if you have multiple domains.
I think this may have been the problem I was having earlier.
1. In front of the sign "?" put a backslash "\".
I have already written to dnsadmin@afraid.org, but received no response.by the way, this script does not appear at mikrotik/agraid.org references and it would be great if it was there: "NOTE: If you've written a client, or have added afraid.org support to your product, please drop me a note so I can add it to the supported clients list. dnsadmin@afraid.org"
# Author: MasterJames
# Date: 2016:06:10
# Corp: SparcAsia Holdings Inc.
:global afraidDomain "yourCustom.AfraidDomain.top"
:global domainUpdateLink "http://sync.afraid.org/u/CrypticV2UpdateStringFromAfraidOrg/"
/tool fetch url="http://icanhazip.com/" dst-path="/whatsMyIP.txt";
:global pubIP [/file get whatsMyIP.txt contents]
:for i from=( [:len $pubIP] - 1 ) to=0 do={
:if ( [:pick $pubIP $i] = "\n") do={
:global curIP [:pick $pubIP 0 $i];
:if ([:resolve $afraidDomain] != $curIP) do={
/tool fetch url="$domainUpdateLink" keep-result=no;
:log info "Afraid.org Update: $afraidDomain - $curIP";
} else={
:log info "Afraid.org: does NOT need updating: $curIP";
}
}
}
name=freedns start-time=startup interval=30m on-event=/system script run freedns owner=kuba policy=ftp,reboot,read,writ
e,policy,test,password,sniff,sensitive
name="freedns" owner="kuba" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive
############## Script FreeDNS.afraid.org ##################
############## PARSER EDITION ##################
############## CREATED LESHIY_ODESSA ##################
# Specify the "Direct URL", which is https://freedns.afraid.org/dynamic/
# If RouterOS version 5.xx, then remove from the URL encryption - "https" change this to "http". Also see below.
# In front of the sign "?" put a backslash "\".
:global "direct-url" "http://freedns.afraid.org/dynamic/update.php\?blablabla"
# Specify the URL API "ASCII"
# Log in under your account and open the page https://freedns.afraid.org/api/
# Then copy the URL of your site - Available API Interfaces : ASCII (!!! NOT XML !!!)
# ATTENTION!!!! Before the question mark, put a backslash "\".
# If RouterOS version 5.xx, then remove from the URL encryption - "https" change this to "http".
:global "api-url" "http://freedns.afraid.org/api/\?action=getdyndns&v=2&sha=blablabla"
# Specify your domain or subdomain.
:global "blablabla.mooo.com"
# Define variables for the external (WAN) interface
# Case sensitive.
:global "pppoe-out1_VDSL"
# !!!!!!!!!!!!!!!!! Nothing more do not need to edit!!!!!!!!!!!!!!!!!
# Check whether the file with the IP domain - freedns.txt
:if ([:len [/file find name=freedns.txt]] > 0) do={
} else={
/tool fetch url=$"api-url" dst-path="/freedns.txt"
}
# Find out the IP address of the domain using the API and parsing.
# Split the file
:local "result" [/file get freedns.txt contents]
:local "startloc" ([:find $"result" $"dns-domain"] + ([:len $"dns-domain"] + 1))
:local "endloc" ([:find $"result" $"direct-url" -1] -1)
:global "dns-domain-ip" [:pick $"result" $"startloc" $"endloc"]
# Find the current IP address on the external interface
:global "current-ip" [/ip address get [find interface=$"out-interface"] address]
# Obtained from IP addresses to be excluded subnet mask
:set "current-ip" [:pick $"current-ip" 0 ([:len $"current-ip"]-3) ]
# Compare the external IP with the IP address of the DNS domain.
:if ($"current-ip" != $"dns-domain-ip") do={
# If different, then sent to freedns.afraid.org our external IP by using Direct URL
:log info ("Service Dynamic DNS: old IP address $"dns-domain-ip" for $"dns-domain" CHANGED to -> $"current-ip"")
/tool fetch url=$"direct-url" keep-result=no
# Download the file with the new IP after 5 sec.
:delay 5
/tool fetch url=$"api-url" dst-path="/freedns.txt"
} else={
# Not to clog the log, you need to comment out this line.
:log info ("IP address is NOT CHANGED, the update is not required")
}
# Since version RouterOS version 6.0rc12 supported encryption /tool fetch mode=https
# In :global "direct-url" need to change to httpS://
# For RouterOS version 6.xx
# /tool fetch mode=https url=$"direct url"
# :global "direct-url" "https://freedns.afraid.org/dynamic/update.php\?UVdjU2lzQmQwSkdjZW9aWkNleTdJdXFtOjg2NTI0NzE="
# http://wiki.mikrotik.com/wiki/Manual:Scripting
# http://wiki.mikrotik.com/wiki/Manual:Scripting-examples
# http://wiki.mikrotik.com/wiki/Manual:Tools/Fetch
# http://forum.ixbt.com/topic.cgi?id=14:60498-86#2373
##############Script FreeDNS.afraid.org##################
Please, can somebody check my settings?
For example I have freedns.mooo.com and my WAN internet connection name is "pppoe-out1_VDSL".Please, can somebody check my settings?
OK, in API link I figure out where was the problem.
:global "out-interface" "pppoe-out1_VDSL"
:global "api-url" "https://freedns.afraid.org/api/\?action=getdyndns&sha=blablabla"
06:12:13 system,info router rebooted
06:12:20 pppoe,ppp,info pppoe-out1_VDSL: initializing...
06:12:20 pppoe,ppp,info pppoe-out1_VDSL: connecting...
06:12:25 pppoe,ppp,info pppoe-out1_VDSL: authenticated
06:12:25 pppoe,ppp,info pppoe-out1_VDSL: connected
06:19:20 script,info IP address is NOT CHANGED, the update is not required
06:37:59 script,info IP address is NOT CHANGED, the update is not required
06:43:50 script,info IP address is NOT CHANGED, the update is not required
07:07:59 script,info IP address is NOT CHANGED, the update is not required
07:37:59 script,info IP address is NOT CHANGED, the update is not required
08:07:59 script,info IP address is NOT CHANGED, the update is not required
08:37:59 script,info IP address is NOT CHANGED, the update is not required
08:41:03 system,info changed script settings by xxx
09:07:59 script,info Service Dynamic DNS: old IP address 83.24.xxx.xxx for freednsname.mooo.com CHANGED to -> 83.9.xx.xxx
09:08:06 info fetch: file "freedns.txt" downloaded
09:37:59 script,info IP address is NOT CHANGED, the update is not required
10:07:59 script,info IP address is NOT CHANGED, the update is not required
10:37:59 script,info IP address is NOT CHANGED, the update is not required
11:07:59 script,info IP address is NOT CHANGED, the update is not required
############## Script FreeDNS.afraid.org ##################
############## PARSER EDITION ##################
############## CREATED LESHIY_ODESSA ##################
# Specify the "Direct URL", which is https://freedns.afraid.org/dynamic/
# If RouterOS version 5.xx, then remove from the URL encryption - "https" change this to "http". Also see below.
# In front of the sign "?" put a backslash "\".
:global "direct-url" "https://freedns.afraid.org/dynamic/update.php\?xxxxxxx"
# Specify the URL API "ASCII"
# Log in under your account and open the page https://freedns.afraid.org/api/
# Then copy the URL of your site - Available API Interfaces : ASCII (!!! NOT XML !!!)
# ATTENTION!!!! Before the question mark, put a backslash "\".
# If RouterOS version 5.xx, then remove from the URL encryption - "https" change this to "http".
:global "api-url" "https://freedns.afraid.org/api/\?action=getdyndns&sha=31313131313131"
# Specify your domain or subdomain.
:global "dns-domain" "test.to"
# Define variables for the external (WAN) interface
# Case sensitive.
:global "out-interface" "pppoe-out1"
# !!!!!!!!!!!!!!!!! Nothing more do not need to edit!!!!!!!!!!!!!!!!!
# Check whether the file with the IP domain - freedns.txt
:if ([:len [/file find name=freedns.txt]] > 0) do={
} else={
/tool fetch mode=https url=$"api-url" dst-path="/freedns.txt"
}
# Find out the IP address of the domain using the API and parsing.
# Split the file
:local "result" [/file get freedns.txt contents]
:local "startloc" ([:find $"result" $"dns-domain"] + ([:len $"dns-domain"] + 1))
:local "endloc" ([:find $"result" $"direct-url" -1] -1)
:global "dns-domain-ip" [:pick $"result" $"startloc" $"endloc"]
# Find the current IP address on the external interface
:global "current-ip" [/ip address get [find interface=$"out-interface"] address]
# Obtained from IP addresses to be excluded subnet mask
:set "current-ip" [:pick $"current-ip" 0 ([:len $"current-ip"]-3) ]
# Compare the external IP with the IP address of the DNS domain.
:if ($"current-ip" != $"dns-domain-ip") do={
# If different, then sent to freedns.afraid.org our external IP by using Direct URL
:log info ("Service Dynamic DNS: old IP address $"dns-domain-ip" for $"dns-domain" CHANGED to -> $"current-ip"")
/tool fetch mode=https url=$"direct-url" keep-result=no
# Download the file with the new IP after 5 sec.
:delay 5
/tool fetch mode=https url=$"api-url" dst-path="/freedns.txt"
} else={
# Not to clog the log, you need to comment out this line.
:log info ("IP address is NOT CHANGED, the update is not required")
}
# Since version RouterOS version 6.0rc12 supported encryption /tool fetch mode=https
# In :global "direct-url" need to change to httpS://
# For RouterOS version 6.xx
# /tool fetch mode=https url=$"direct url"
# http://wiki.mikrotik.com/wiki/Manual:Scripting
# http://wiki.mikrotik.com/wiki/Manual:Scripting-examples
# http://wiki.mikrotik.com/wiki/Manual:Tools/Fetch
# http://forum.ixbt.com/topic.cgi?id=14:60498-86#2373
##############Script FreeDNS.afraid.org##################
The script works if you have multiple domains.It worked!
I had two domains registered in freedns.afraid.org with different target ips (unlinked). I deleted the second one.
Moreover, for some reason in script source (winbox) text was unformatted (without spaces, tabs etc) so I uploaded again correctly.
https://github.com/midenok/hardware/blob/master/mikrotik/freedns.rsc
Sorry, but I do not have the opportunity to check.Did it works on the newest 6.42.1?
MT cloud is very unstable and NTP is almost always incorrect.Sorry, but I do not have the opportunity to check.Did it works on the newest 6.42.1?
In order not to lose access, you can simultaneously use — https://wiki.mikrotik.com/wiki/Manual:IP/Cloud (Starting with RouterOS v6.14).
please help meSomething more easy using freedns v2.
See attachment.
Modify your freedns v2 key.
Run import script.
freedns-v2-opic-import.rsc