Page 1 of 1

Loopia dynamic DNS

Posted: Fri Feb 10, 2017 3:29 am
by bjornekelund
Does anyone have a working script for Loopia Dynamic DNS? I have been able to write working scripts
for Dynu and No-IP and others but I can't seem to get it right for Loopia.

Im working a RB2011 running RouterOS 6.38.1.

I'm very new at RouterOS scripting so that may be part of the reason...

Any help appreciated!

Re: Loopia dynamic DNS

Posted: Fri Feb 10, 2017 11:21 am
by pukkita
There's no need for those services, you have one already built in at IP > Cloud.

See http://wiki.mikrotik.com/wiki/Manual:IP/Cloud

There's an specific forum section for scripting help: http://forum.mikrotik.com/viewforum.php?f=9

Re: Loopia dynamic DNS

Posted: Fri Feb 10, 2017 4:00 pm
by bjornekelund
Thank you!
I however need to update a specific address, not a randomly generated albeit personal one.
I will move to the Scripting forums and continue my search.

Re: Loopia dynamic DNS

Posted: Fri Feb 10, 2017 9:20 pm
by Larsa
There's no need for those services, you have one already built in at IP > Cloud. See http://wiki.mikrotik.com/wiki/Manual:IP/Cloud
Well, that's not quite the same thing. You still need a script to update the DNS server of a particular provider, Loopia in this case.

I would use the free DNS-O-Matic (dnsomatic.com) that has built-in support for many different providers including Loopia. You will only need a single DDNS-script that never needs to change. The only thing you need to do if you switch provider is to change the settings in DNS-O-Matic.

Example of DNS-O-Matic script: http://forum.mikrotik.com/viewtopic.php ... ic#p550026

Re: Loopia dynamic DNS

Posted: Fri Feb 10, 2017 11:19 pm
by Sob
My favourite way:
myrouter.mydomain.tld CNAME xxxxx.sn.mynetname.net
No need for any scripts or involving other parties.

Re: Loopia dynamic DNS

Posted: Sat Feb 11, 2017 1:00 am
by Larsa
My favourite way:
myrouter.mydomain.tld CNAME xxxxx.sn.mynetname.net
No need for any scripts or involving other parties.
Simple, yet very smart and elegant! I like :-D
Do you think it will work with resource records like SPF and DKIM too?

Re: Loopia dynamic DNS

Posted: Sat Feb 11, 2017 4:38 am
by Sob
I'm affraid you just discovered one weakness of this method. Hostname with CNAME record can't have any other records.

Re: Loopia dynamic DNS

Posted: Sat Feb 11, 2017 9:20 am
by andlil
This one works for me and Loopia, not my code though.

//A
:global ddnsuser "loopiaUsername"
:global ddnspass "loopiaPassword"
:global theinterface "ether1-gateway"
:global ddnshost my.domain.name
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
#:log info ("ipddns $ipddns")
#:log info ("ipfresh $ipfresh")
:if ([ :typeof $ipfresh ] = nil ) do={
   :log info ("DynDNS: No ip address on $theinterface .")
} else={
   :for i from=( [:len $ipfresh] - 1) to=0 do={ 
      :if ( [:pick $ipfresh $i] = "/") do={ 
    :set ipfresh [:pick $ipfresh 0 $i];
      } 
}
 
:if ($ipddns != $ipfresh) do={
    :log info ("DynDNS: IP-DynDNS = $ipddns")
    :log info ("DynDNS: IP-Fresh = $ipfresh")
   :log info "DynDNS: Update IP needed, Sending UPDATE...!"
   :global str "/XDynDNSServer/XDynDNS.php?hostname=$ddnshost&myip=$ipfresh&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
   /tool fetch address=dns.loopia.se src-path=$str mode=http user=$ddnsuser \
         password=$ddnspass dst-path=("/DynDNS.".$ddnshost)
    :delay 1
    :global str [/file find name="DynDNS.$ddnshost"];
    /file remove $str
    :global ipddns $ipfresh
  :log info "DynDNS: IP updated to $ipfresh!"
    } else={
     :log info "DynDNS: dont need changes";
    }
}