Community discussions

MikroTik App
 
markinhusxp
just joined
Topic Author
Posts: 4
Joined: Wed Mar 13, 2024 2:59 pm

DDNS configuration with 2 links

Wed Mar 13, 2024 3:05 pm

Hello everybody,
I have a question with my Mikrotik and needed help with this configuration.
I have some Mikrotiks RB750 GR3 installed on several clients, I am implementing link monitoring on the internet interfaces of these clients and I needed my DDNS (NoIP) to update not only the first interface of my Mikrotik but both.
I looked in several places for a way for this to work and I found absolutely nothing. When I find a script that runs my two DDNS addresses on the interfaces, they only update the first interface.
In all my clients, the links are configured in NAT via DMZ, which makes my service a little more difficult.
Could anyone help me with this demand?
Thank you very much in advance!
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19405
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: DDNS configuration with 2 links

Thu Mar 14, 2024 5:02 pm

Typically a dyndns link to a public IP, is to ONE public IP not two and more specifically to the primary ACTIVE wanip.
If you have two active WANIPs, then you need two dyndns URLs to access them.
Not sure if that answers your question.
 
markinhusxp
just joined
Topic Author
Posts: 4
Joined: Wed Mar 13, 2024 2:59 pm

Re: DDNS configuration with 2 links

Thu Mar 14, 2024 7:32 pm

Good afternoon,
In my case, I have 2 DDNS addresses, the primary interface updates it without any problem, what I basically need is for the secondary interface to update the other DDNS.
Example: Interface "ether1" updates ddns x.ddns.net → ok
Interface "ether2" does not update ddns y.ddns.net
The Script I ran updates both x.ddns.net and y.ddns.net, as if both came from "ether1", I need "ether2" to update y.ddns.net.
I hope I'm clearer now, thanks!
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19405
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: DDNS configuration with 2 links

Thu Mar 14, 2024 7:35 pm

You need to clarify....
a. who or what has a script?
b. where is this script aimed at.
c. what is the current configuration of your router ( vis-a-vis WAN setup ).
 
markinhusxp
just joined
Topic Author
Posts: 4
Joined: Wed Mar 13, 2024 2:59 pm

Re: DDNS configuration with 2 links

Thu Mar 14, 2024 8:01 pm

a. This is the script I mentioned, as Mikrotik does not have a DDNS update system by default, I got this script and configured a schedule to run every 5 minutes.
:local noipuser "xxx"
:local noippass "xxx"
:local hostname1 "x.ddns.net"
:local hostname2 "y.ddns.net"
:local interface1 "VIVO-16 (CPF)"
:local interface2 "VIVO-15 (CNPJ)"

:local ip1 [/ip cloud get public-address];
:local ip2 [/ip cloud get public-address];

:log info "IP Público da $interface1: $ip1"
:log info "IP Público da $interface2: $ip2"

:log info "Atualizando DDNS No-IP para $hostname1"
:local nochg1 [/tool fetch mode=http user=$noipuser password=$noippass url="http://dynupdate.no-ip.com/nic/update\?hostname=$hostname1&myip=$ip1" keep-result=no];
:log info "Resposta do servidor No-IP: $nochg1"

:log info "Atualizando DDNS No-IP para $hostname2"
:local nochg2 [/tool fetch mode=http user=$noipuser password=$noippass url="http://dynupdate.no-ip.com/nic/update\?hostname=$hostname2&myip=$ip2" keep-result=no];
:log info "Resposta do servidor No-IP: $nochg2"
b. My WANS are in NAT, I work with recursive routes.
/ip route
add check-gateway=ping comment="Rota Recursiva Link CPF (Vivo 16 - CPF)" \
    disabled=no distance=2 dst-address=0.0.0.0/0 gateway=8.8.8.8 pref-src="" \
    routing-table=main scope=30 suppress-hw-offload=no target-scope=11
add check-gateway=ping comment="Rota Recursiva Link CNPJ (Vivo 15 - CNPJ)" \
    disabled=no distance=3 dst-address=0.0.0.0/0 gateway=8.8.4.4 pref-src="" \
    routing-table=main scope=30 suppress-hw-offload=no target-scope=11
add comment="Rota Recursiva Link CPF (Vivo 16 - CPF)" disabled=no distance=1 \
    dst-address=8.8.8.8/32 gateway=192.168.16.1 pref-src="" routing-table=\
    main scope=10 suppress-hw-offload=no target-scope=10
add comment="Rota Recursiva Link CNPJ (Vivo 15 - CNPJ)" disabled=no distance=\
    1 dst-address=8.8.4.4/32 gateway=192.168.15.1 pref-src="" routing-table=\
    main scope=10 suppress-hw-offload=no target-scope=10
add comment="Rota Mangle Link 1" disabled=no distance=1 dst-address=0.0.0.0/0 \
    gateway=192.168.15.1 pref-src="" routing-table=Mark1-Route scope=30 \
    suppress-hw-offload=no target-scope=10
add comment="Rota Mangle Link 2" disabled=no distance=1 dst-address=0.0.0.0/0 \
    gateway=192.168.16.1 pref-src="" routing-table=Mark2-Route scope=30 \
    suppress-hw-offload=no target-scope=10
add comment="Rota de Saida The Dude Link 2" disabled=no distance=1 \
    dst-address=0.0.0.0/0 gateway=192.168.15.1 pref-src="" routing-table=\
    Link2-WAN scope=30 suppress-hw-offload=no target-scope=10
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19405
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: DDNS configuration with 2 links

Thu Mar 14, 2024 8:08 pm

The config was not really what I was asking for but since you did post it your routes are hosed/incorrect. More on that later.

So the script finds the new IP for WAN1 and WAN2 locally on the router, and sends it to the dyndns website and updates it............. ??
To confirm, though it would appear you said that each router is not connected to a public IP but is connected to an upstream router and gets NAT and DMZ.
So really you are confirming the public iP that an upstream router gets?

If so, is it two upstream routers (each a different provider) or does your upstream non-mt router handle two WAN inputs..... Very confused at the moment.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19405
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: DDNS configuration with 2 links

Thu Mar 14, 2024 8:26 pm

/ip route
add check-gateway=ping distance=2 dst-address=0.0.0.0/0 gateway=8.8.8.8 \
routing-table=main scope=30 target-scope=11
add check-gateway=ping distance=3 dst-address=0.0.0.0/0 gateway=8.8.4.4 \
routing-table=main scope=30 target-scope=11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
add distance=1 dst-address=8.8.8.8/32 gateway=192.168.16.1 \
routing-table=main scope=10 target-scope=10
add distance=1 dst-address=8.8.4.4/32 gateway=192.168.15.1 \
routing-table=main scope=10 target-scope=10


Should be:
/ip route
add check-gateway=ping comment="Rota Recursiva Link CPF (Vivo 16 - CPF)" \
disabled=no distance=2 dst-address=0.0.0.0/0 gateway=8.8.8.8 pref-src="" \
routing-table=main scope=10 suppress-hw-offload=no target-scope=11
add check-gateway=ping comment="Rota Recursiva Link CNPJ (Vivo 15 - CNPJ)" \
disabled=no distance=3 dst-address=0.0.0.0/0 gateway=8.8.4.4 pref-src="" \
routing-table=main scope=10 suppress-hw-offload=no target-scope=11
add comment="Rota Recursiva Link CPF (Vivo 16 - CPF)" disabled=no distance=2 \
dst-address=8.8.8.8/32 gateway=192.168.16.1 pref-src="" routing-table=\
main scope=10 suppress-hw-offload=no target-scope=10
add comment="Rota Recursiva Link CNPJ (Vivo 15 - CNPJ)" disabled=no distance=\
3 dst-address=8.8.4.4/32 gateway=192.168.15.1 pref-src="" routing-table=\
main scope=10 suppress-hw-offload=no target-scope=10
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19405
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: DDNS configuration with 2 links

Thu Mar 14, 2024 8:27 pm

I gather WAN1 is primary and WAN2 is secondary?
Is there any traffic for WAN2 even when WAN1 is up and running??
 
markinhusxp
just joined
Topic Author
Posts: 4
Joined: Wed Mar 13, 2024 2:59 pm

Re: DDNS configuration with 2 links

Fri Apr 12, 2024 2:37 pm

Good morning Anav,
Sorry for my absence, I ended up being away from work for a month due to health problems.
Regarding your adjustment, I will try to explain more or less how my environment works.
When I set Scope to 10, both links stop working, this started to happen after upgrading Mikrotik from Version 6 to Version 7 and I was forced to use Scope 11, I found this "solution" on Mikrotik forums also.
I use route marking in Mangle so that the 2 links work as per the request. For example: If I try to communicate with port X via the secondary link (theoretically inactive), the port receives the communication and works perfectly.
And yes, WAN1 is my primary route, with distance 2 and WAN2 is the secondary route, so I use distance 3 on it.

Who is online

Users browsing this forum: baragoon, BoraHorza, Buckeye and 29 guests