Community discussions

MikroTik App
 
WildWurger
just joined
Topic Author
Posts: 24
Joined: Mon Jan 13, 2014 2:36 am

DDNS - Update multiple interface

Sun Dec 28, 2014 8:06 pm

Hi all experts,
I am facing some problem, and really appreciate if someone is able to help me.
I wanted to update FreeDNS (afraid.org) DDNS IP for my VPN client connections.

I have subscribed quite a few VPN, and they all connected in the Mikrotik for various testing and so on.
And I would like to use DDNS on each and every connection on them, for example:-

1) Connected Internet PPPoE = 1DDNS address
2) VPN1 (PPTP) = 1DDNS
3) VPN2 (PPTP) = 1DDNS
4) VPN3 (L2TP) = 1DDNS
5) and so on.

From what i found, I see only scripts that is able to update the 1st one which is the one i use to connect to the internet (PPPoE)
Is there any ways to update all the connected VPN via script, specifically for FreeDNS (afraid.org) and DynDNS.

Thank you very much in advance.

I do have some script below, which found in the forum/internet. I take no credit on these.
But I believe this script works like this.

Find the difference for my VPN connection, once found, update the IP. (But the IP it updates is from PPPoE and Not from the VPN itself.
:global currentIP1;

:local newIP1 [/ip address get [find interface="pptp.vpn1"] address];

:if ($newIP1 != $currentIP1) \
  do={ \
    :log info "FreeDNS: IP changed, update required, Updating..."; \

#Update DNS on freedns.afraid.org
    /tool fetch mode=http url="https://freedns.afraid.org/dynamic/update.php\?<random_freedns_string>=" keep-result=no host="freedns.afraid.org"
    :log info "FreeDNS: FreeDNS IP updated to $newIP1 !"
    :set currentIP1 $newIP1; \
  }  else={ \
     :log info "FreeDNS: FreeDNS IP = current IP ($currentIP1), update not required."; \
  }


 
WildWurger
just joined
Topic Author
Posts: 24
Joined: Mon Jan 13, 2014 2:36 am

Re: DDNS - Update multiple interface

Mon Dec 29, 2014 7:58 pm

Any help? Please...
 
Sob
Forum Guru
Forum Guru
Posts: 9188
Joined: Mon Apr 20, 2009 9:11 pm

Re: DDNS - Update multiple interface

Mon Dec 29, 2014 11:09 pm

I assume their update server uses client's address and you can't simply specify your own. So you just need to make the update connection go through the right VPN. That should not be too hard, basic algorithm would be like this (pseudocode):
if address_changed(<interface>) {
  server_address = resolve(hostname=freedns.afraid.org)
  temproute = add_static_route(to=server_address/32, gw=<interface_gw>)
  call_update()
  remove_static_route(temproute)
}
 
WildWurger
just joined
Topic Author
Posts: 24
Joined: Mon Jan 13, 2014 2:36 am

Re: DDNS - Update multiple interface

Fri Jan 09, 2015 8:21 pm

Hi sob/all,

I have tried for many days but still unable to do so i gave up.

Can please somebody enlighten me with some examples on how you do it. What I want to achieve is automating update for multiple DDNS with multiple different IP address on interface.

Thanks, you kind help is greatly appreciated...

Thank you
 
bingo220
Member Candidate
Member Candidate
Posts: 126
Joined: Sun Sep 22, 2013 9:30 pm
Location: Ukraine

Re: DDNS - Update multiple interface

Sat Jan 10, 2015 1:02 pm

Try do it with "no-ip" ddns.
I think it has to work, because I can send even fake-ip to the server.
http://forum.mikrotik.com/viewtopic.php ... 44#p419745