Community discussions

MikroTik App
 
Pietist
just joined
Topic Author
Posts: 1
Joined: Fri Jun 15, 2018 6:09 pm

DNSdynamic script for RouterOS v6

Fri Jun 15, 2018 6:23 pm

I want to use script to inform DNSdynamic about my ip.
https://www.dnsdynamic.org/compatibility.php
I has changed example for No-IP and composed this script for DNSdynamic:
# DNSdynamic update
#User account info
:local dnsdynamicuser "amuliar@protonmail.ch"
:local dnsdynamicpass "YL6a1##DynaPietist"
:local dnsdynamichost "pietist.ssh22.net"

# Change to the name of interface that gets the dynamic IP address
:local inetinterface "pppoe-out-langate"

:global previousIP

:if ([/interface get $inetinterface value-name=running]) do={
# Get the current IP on the interfacea
   :local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]

# Strip the net mask off the IP address
   :for i from=( [:len $currentIP] - 1) to=0 do={
       :if ( [:pick $currentIP $i] = "/") do={ 
           :set currentIP [:pick $currentIP 0 $i]
       } 
   }

   :if ($currentIP != $previousIP) do={
       :log info "IP: Current IP $currentIP is not equal to previous IP, update needed"
       :set previousIP $currentIP

# The update dnsdynamic URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
       :local url "https://www.dnsdynamic.org/api/\3Fhostname=$dnsdynamichost&myip=$currentIP"
       :log info "dnsdynamic: $url"
       :local dnsdynamichostarray
       :set dnsdynamichostarray [:toarray $dnsdynamichost]
       :foreach host in=$dnsdynamichostarray do={
           :log info "dnsdynamic: Sending update for $host"
           /tool fetch url=$url user=$dnsdynamicuser password=$dnsdynamicpass mode=https dst-path=("dnsdynamic_ddns_update-" . $host . ".txt")
           :log info "dnsdynamic: Host $host updated on dnsdynamic with IP $currentIP"
       }
   }  else={
       :log info "IP: Previous IP $previousIP is equal to current IP, no update needed"
   }
} else={
   :log info "IP: $inetinterface is not currently running, so therefore will not update."
}
I suppose, something is not correct here because "dnsdynamic: Host $host updated on dnsdynamic with IP $currentIP" doesn't appear in log.
Could you please help me to figure out what is incorrect?

RouterOS v6.40.4
 
MSandoval
newbie
Posts: 26
Joined: Thu Mar 01, 2018 3:32 pm

Re: DNSdynamic script for RouterOS v6

Tue Jul 17, 2018 7:28 pm

if you want you can use the DNS options that the mikrotik brings.

IP > Cloud - DNS Enable

And then use the DNS name that give you. I hope can help you.

And very important. I recommend you delete your information about your loggin in the dnsdynamic.org. because any can loggin and use that information against you.

Image
http://subirimagen.me/uploads/20180717112726.jpg
 
User avatar
dasiu
Trainer
Trainer
Posts: 231
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: DNSdynamic script for RouterOS v6

Tue Jul 17, 2018 7:38 pm

OMG, MSandoval! I didn't notice, that he included his real login information in the script! Thanks for pointing it out loud, so all of us now can notice it! :)
 
gotsprings
Forum Guru
Forum Guru
Posts: 2118
Joined: Mon May 14, 2012 9:30 pm

Re: DNSdynamic script for RouterOS v6

Tue Jul 17, 2018 11:40 pm

I have resorted to using a script that writes all the user/pass/hostname to global variables at start up. Then my dyndns updater calls that info... so i don't make that mistake right there.
 
caraspeciali
just joined
Posts: 1
Joined: Tue Feb 21, 2023 3:25 pm

Re: DNSdynamic script for RouterOS v6

Tue Feb 21, 2023 3:28 pm

if you want you can use the DNS options that the mikrotik brings.

IP > Cloud - DNS Enable

And then use the DNS name that give you. I hope can help you.

And very important. I recommend you delete your information about your loggin in the dnsdynamic.org. because any can loggin and use that information against you.

[img]http://subirimagen.me/uploads/20180717112726.jpg[/img]
http://subirimagen.me/uploads/20180717112726.jpg
Thanks..
 
dollargenral
just joined
Posts: 1
Joined: Mon Jun 12, 2023 6:06 pm

Re: DNSdynamic script for RouterOS v6

Mon Jun 12, 2023 6:12 pm

Dynamic DNS Update Device gives a method for keeping the space name highlighting a unique IP address. It works by sending a space name framework update solicitations to the name server, which has a zone to be refreshed. Secure DNS refreshes are additionally upheld. DGme Login

Who is online

Users browsing this forum: No registered users and 41 guests