Hi.
I’m looking for freedns.afraid.org script. This script don’t work http://forum.mikrotik.com/t/freedns-afraid-org-script/75968/36
RB951Ui-2HnD firmware v6.48.2
I second this. I have tried a different script that also doesn’t work on the 4011. I think most of them are out of date.
I just run this:
:delay 10
:resolve freedns.afraid.org
:delay 20
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\?key-goes-here" keep-result=no
in the PPP profile script, substituting “key-goes-here” for the real update key.
I’m using routeros v6.49
/tool fetch mode=https url="https://freedns.afraid.org/dynamic/update.php___KEY___" keep-result=no
status: failed
failure: closing connection: <404 Not Found> 69.42.215.252:443 (4)
My key above has been replaced with KEY for posting.
This used to work for me, but I haven’t checked it recently and now it fails. I retrieved the URL again from my acct. on Afraid to confirm nothing changed and it still fails.
This worked on v6.49:
/tool fetch mode=https url="https://freedns.afraid.org" http-data="dynamic/update.php__MYKEY__" keep-result=no
.
.
/tool fetch mode=https url="https://freedns.afraid.org" http-data="dynamic/update.php__MYKEY__" keep-result=no
status: finished
downloaded: 12KiB-z pause]
total: 0KiB
duration: 0s
Better yet, here’s the whole script down below.
- You’ll need to update the variables at the top with YOUR info.
- WANInter is what you’ve named your interface that connects to your ISP.
- AfraidDomain is what YOU use for your subdomain name on Afraid.org.
- Remove the underscores surrounding YOUR_KEY and just paste your key after “php”, no spaces.
.
.
:global AfraidUser "YOUR_Afraid_Username"
:global AfraidPass "YOUR_Afraid_Password"
:global WANInter "WAN"
:global AfraidDomain "YOUR_Afraid.domain.com"
:global IPCurrent [/ip address get [find interface=$WANInter] address];
:log info $IPCurrent
# FOR loop strips CIDR from end of IP address
:for i from=( [:len $IPCurrent] - 1) to=0 do={
:if ( [:pick $IPCurrent $i] = "/") do={
:global NewIP [:pick $IPCurrent 0 $i];
:global NoCIDR [:pick $IPCurrent 0 $i];
:log info $NoCIDR
:if ([:resolve $AfraidDomain] != $NewIP) do={
:log info [/tool fetch mode=https url="https://freedns.afraid.org/dynamic" http-data="/update.php__YOUR_KEY__" keep-result=no]
:log info "Afraid.org New IP Found: $AfraidDomain - $NewIP"
} else={
:log info "Afraid.org: CURRENT IP: $NoCIDR NEW IP: $NewIP";
}
}
}
Thanks caed, that worked like a charm! Also had to change the permissions from my many years old script.
Can you maybe elaborate what permissions are needed (and which ones could be turned off)?
Hello,
Can someone help me with the following script:
When I run it directly from the console it works and changes the IP of the subdomain:
[admin@MikroTik] > /tool fetch url="http://sync.afraid.org/u/loremipsumRQsZKkETekqx/" keep-result=no
status: finished
downloaded: 0KiBC-z pause]
total: 0KiB
duration: 0s
But if I run it from the web interface it does nothing:
Set "don't require permissions" or select "test" policy.
