Page 1 of 1
Wget Afraid - FREEDNS script help
Posted: Fri Aug 22, 2008 7:54 pm
by Jeeva
Hi
freedns.afraig.org offers 'n Dynamic DNS service, but it order to do so, i need to be able to run the following linux script on the mikrotik. Is there someone that can help me out with it. Want it to update every 5mins and then delete the url it downloaded a few seconds later (otherwise i will sit with 288 entries a day)
Code from afraid.org:
rem my.domain.co.za
wget -q --read-timeout=0.0 --waitretry=5 --tries=400 --background http://freedns.afraid.org/dynamic/update.php?U3hWWThhdE8wcHFRMzN<rest of the url>
or I can just download the url:
http://freedns.afraid.org/dynamic/update.php?U3hWWThhdE8wcHFRMzN<rest of the url>
but it must also delete the url aswell
Thanks
Re: Wget Afraid - FREEDNS script help
Posted: Wed Feb 25, 2009 11:31 pm
by tagno25
Hi
freedns.afraig.org offers 'n Dynamic DNS service, but it order to do so, i need to be able to run the following linux script on the mikrotik. Is there someone that can help me out with it. Want it to update every 5mins and then delete the url it downloaded a few seconds later (otherwise i will sit with 288 entries a day)
Code from afraid.org:
rem my.domain.co.za
wget -q --read-timeout=0.0 --waitretry=5 --tries=400 --background http://freedns.afraid.org/dynamic/update.php?U3hWWThhdE8wcHFRMzN<rest of the url>
or I can just download the url:
http://freedns.afraid.org/dynamic/update.php?U3hWWThhdE8wcHFRMzN<rest of the url>
but it must also delete the url aswell
Thanks
change your code to
rem my.domain.co.za
wget -q --read-timeout=0.0 --waitretry=5 --tries=400 --background http://freedns.afraid.org/dynamic/update.php?U3hWWThhdE8wcHFRMzN<rest of the url> -O=afraid.org
added " -O=afraid.org" to write over the same file (in this case I called the file afraid.org, but you can change it)
Have you found out where to put the code?
Re: Wget Afraid - FREEDNS script help
Posted: Wed Jun 03, 2009 10:08 pm
by S1ghup
In regards to using wget to update your dynamic IP address with afraid.org, I'm afraid (no pun intended) it is not possible at this time. However if you are running RouterOS 3.+ you can achieve this using the fetch tool as seen below. I currently run this on RoS 3.16 and it works with out flaw.
Note: The update token in the example below has been changed to protect the innocent and my router.
/tool fetch address="freedns.afraid.org" host="freedns.afraid.org" mode=http src-path="dynamic/update.php\?bnptVU90TjcTWDVsMjNlAMk81WUg6MzYyNjYxMg==" keep-result=no
Important things to notice/remember:
1. Parameter: src-path take notice of the "\" after the .php this is required to escape the ?
2. Parameter: keep-result - Can be set to yes or no -
No - By setting this to no we tell the router to ignore the response file from afraid.org
Yes - By setting this to yes we tell the router to store the result of the last update in /file with the name .php?<your-unique-token>
You can use the system scheduler to execute this script on a timed interval if you like.
Regards,
John Annis - Vortex Consulting
Re: Wget Afraid - FREEDNS script help
Posted: Thu Jun 04, 2009 8:54 am
by mrz
In the latest version you can also use "/tool fetch url=..."
Re: Wget Afraid - FREEDNS script help
Posted: Mon Mar 26, 2012 10:24 am
by stefanz
Does anyone use
www.freedns.afraid.org DDNS services on Mikrotik devices? I'm trying to configure on a Mikrotik router to use the DDNS service provided by freedns.afraid.org but I didn't find any script or solution.
Re: Wget Afraid - FREEDNS script help
Posted: Wed Apr 18, 2012 11:55 pm
by ayufan
I use this simple own script. Just copy and run in command line. Than you have to update System/Scheduler script with your external interface and update key. This script gets ip address from pppoe-client interface. However, you can easily change that.
/system scheduler
add disabled=no interval=30s name="dynamic dns" on-event="/ interface pppoe-clie\
nt {\r\
\n\t:global ExternalIP\r\
\n\t:local clientip\r\
\n\t:local clientstatus\r\
\n\tmonitor External once do={:set clientip \$\"local-address\"; :set client\
status \$status}\r\
\n\t:if (\$clientstatus=\"connected\" and \$ExternalIP!=\$clientip) do={\r\
\n\t\t:log info \"External IP changed from \$ExternalIP to \$clientip\"\r\
\n\t\t/ tool fetch url=\"http://freedns.afraid.org/dynamic/update.php\\\?<put_key>\" dst-path=ExternalIP.txt\r\
\n\t\t:set ExternalIP \$clientip\r\
\n\t}\r\
\n}" policy=ftp,read,write,policy,test,winbox,password,sniff,api \
start-time=startup
Re: Wget Afraid - FREEDNS script help
Posted: Thu Apr 19, 2012 11:16 am
by stefanz
Thank you
Re: Wget Afraid - FREEDNS script help
Posted: Fri Apr 20, 2012 12:43 pm
by bax
I use this simple own script. Just copy and run in command line. Than you have to update System/Scheduler script with your external interface and update key. This script gets ip address from pppoe-client interface. However, you can easily change that.
/system scheduler
add disabled=no interval=30s name="dynamic dns" on-event="/ interface pppoe-clie\
nt {\r\
\n\t:global ExternalIP\r\
\n\t:local clientip\r\
\n\t:local clientstatus\r\
\n\tmonitor External once do={:set clientip \$\"local-address\"; :set client\
status \$status}\r\
\n\t:if (\$clientstatus=\"connected\" and \$ExternalIP!=\$clientip) do={\r\
\n\t\t:log info \"External IP changed from \$ExternalIP to \$clientip\"\r\
\n\t\t/ tool fetch url=\"http://freedns.afraid.org/dynamic/update.php\\\?<put_key>\" dst-path=ExternalIP.txt\r\
\n\t\t:set ExternalIP \$clientip\r\
\n\t}\r\
\n}" policy=ftp,read,write,policy,test,winbox,password,sniff,api \
start-time=startup
This was not work for me ... ROS v 5.14 ...
I was change interface to my interface name ad fetch url ...
Sorry Im to fast
It working !
Re: Wget Afraid - FREEDNS script help
Posted: Wed Jun 26, 2013 2:57 am
by jensbodal
In the latest version you can also use "/tool fetch url=..."
Thanks, that was easy enough. If anyone does this just make sure to escape the ? here as well, for example:
/tool fetch url="
http://freedns.afraid.org/dynamic/updat ... ROMTHEURL="
Anyone know if it matters how often you send this request? It looks like the server tells you that nothing needs to update if the IP is the same so I would imagine it's fine to run this every 5 minutes or something.
Re: Wget Afraid - FREEDNS script help
Posted: Fri Dec 27, 2013 5:37 pm
by midenok
Or you can try
this script.
Re: Wget Afraid - FREEDNS script help
Posted: Fri Dec 27, 2013 5:40 pm
by midenok
Or you can try
this script.
Re: Wget Afraid - FREEDNS script help
Posted: Sun Sep 07, 2014 2:04 am
by LESHIYODESSA
I wrote my own script.
The most important thing!!! The script works if you have multiple domains.
############## 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##################
Re: Wget Afraid - FREEDNS script help
Posted: Wed Oct 01, 2014 12:18 am
by vbbojan
@LESHIYODESSA
Thanks for the script, but I have problem with finding domain IP address because API call:
http://freedns.afraid.org/api/\?action= ... -HERE-----
returns:
ERROR: Could not authenticate.
Any idea why it does not work?
Re: Wget Afraid - FREEDNS script help
Posted: Sun Oct 26, 2014 1:38 pm
by dcavni
I use this simple own script. Just copy and run in command line. Than you have to update System/Scheduler script with your external interface and update key. This script gets ip address from pppoe-client interface. However, you can easily change that.
/system scheduler
add disabled=no interval=30s name="dynamic dns" on-event="/ interface pppoe-clie\
nt {\r\
\n\t:global ExternalIP\r\
\n\t:local clientip\r\
\n\t:local clientstatus\r\
\n\tmonitor External once do={:set clientip \$\"local-address\"; :set client\
status \$status}\r\
\n\t:if (\$clientstatus=\"connected\" and \$ExternalIP!=\$clientip) do={\r\
\n\t\t:log info \"External IP changed from \$ExternalIP to \$clientip\"\r\
\n\t\t/ tool fetch url=\"http://freedns.afraid.org/dynamic/update.php\\\?<put_key>\" dst-path=ExternalIP.txt\r\
\n\t\t:set ExternalIP \$clientip\r\
\n\t}\r\
\n}" policy=ftp,read,write,policy,test,winbox,password,sniff,api \
start-time=startup
Is there anything that needs to be changed for RouterOS version 6.20. I tried this script, copied my key after question mark with = at the end and changed interface name to "pppoe-out1" since that is the name of PPPoE client interface in interfaces list. What am i doing wrong?
Thank you
Re: Wget Afraid - FREEDNS script help
Posted: Mon Nov 03, 2014 1:35 pm
by LESHIYODESSA
I don't see the
whole your script. Version RouterOS?
returns:
ERROR: Could not authenticate.
Any idea why it does not work?
I don't understand what gives the error.
The script is 100% working on RouterOS 5.xx and
RouterOS 6.xx
Re: Wget Afraid - FREEDNS script help
Posted: Mon May 01, 2017 10:25 pm
by qbek
I done everything like LESHIYODESSA said. But I don't see any info at logs, it just appear one time when I run script.I just want to see if this works or not.
Re: Wget Afraid - FREEDNS script help
Posted: Mon May 01, 2017 10:56 pm
by LESHIYODESSA
I done everything like LESHIYODESSA said. But I don't see any info at logs, it just appear one time when I run script.I just want to see if this works or not.
Go
Re: Wget Afraid - FREEDNS script help
Posted: Mon Sep 25, 2017 4:12 am
by easyyu
Or you can try
this script.
Thx mate..
This is only script what worked for me!