Community discussions

MUM Europe 2020
 
User avatar
bjornekelund
just joined
Topic Author
Posts: 13
Joined: Sun Feb 05, 2017 10:32 pm
Contact:

Loopia dynamic DNS

Fri Feb 10, 2017 3:29 am

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!
 
User avatar
pukkita
Trainer
Trainer
Posts: 2986
Joined: Wed Dec 04, 2013 11:09 am
Location: Spain

Re: Loopia dynamic DNS

Fri Feb 10, 2017 11:21 am

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
Simplicity is the Ultimate Sophistication - Da Vinci
Getting the most out of this forum
 
User avatar
bjornekelund
just joined
Topic Author
Posts: 13
Joined: Sun Feb 05, 2017 10:32 pm
Contact:

Re: Loopia dynamic DNS

Fri Feb 10, 2017 4:00 pm

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.
 
Larsa
Member Candidate
Member Candidate
Posts: 119
Joined: Sat Aug 29, 2015 7:40 pm

Re: Loopia dynamic DNS

Fri Feb 10, 2017 9:20 pm

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
 
Sob
Forum Guru
Forum Guru
Posts: 4863
Joined: Mon Apr 20, 2009 9:11 pm

Re: Loopia dynamic DNS

Fri Feb 10, 2017 11:19 pm

My favourite way:
myrouter.mydomain.tld CNAME xxxxx.sn.mynetname.net
No need for any scripts or involving other parties.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
Larsa
Member Candidate
Member Candidate
Posts: 119
Joined: Sat Aug 29, 2015 7:40 pm

Re: Loopia dynamic DNS

Sat Feb 11, 2017 1:00 am

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?
 
Sob
Forum Guru
Forum Guru
Posts: 4863
Joined: Mon Apr 20, 2009 9:11 pm

Re: Loopia dynamic DNS

Sat Feb 11, 2017 4:38 am

I'm affraid you just discovered one weakness of this method. Hostname with CNAME record can't have any other records.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
andlil
just joined
Posts: 13
Joined: Sat Oct 08, 2016 7:38 pm
Location: Sweden

Re: Loopia dynamic DNS

Sat Feb 11, 2017 9:20 am

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";
    }
} 

Who is online

Users browsing this forum: No registered users and 83 guests