Community discussions

MikroTik App
 
User avatar
zBear
just joined
Topic Author
Posts: 23
Joined: Sat Mar 07, 2015 6:17 pm

Static DNS Priority

Wed Mar 13, 2024 12:53 pm

Hi,

I have a general question about static DNS logic in Mikrotik

Let's say in I have 3 records in IP -> DNS -> Static:
1 dns.nextdns.io 214.183.163.111
2 dns.nextdns.io 215.184.164.222
3 dns.nextdns.io 216.185.165.333

Questions:
  1. When a new DNS request is received and there is no answer in cache, is it forwarded to the first static record?
  2. If the first static record is not responding, will it be automatically forwarded to the second one or the third one?
  3. If the second responded, next request will be addressed directly to the second static record or it will start from the first again?
  4. If it's addressed to the second one directly, what conditions are necessary to go back to the first record?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10248
Joined: Mon Jun 08, 2015 12:09 pm

Re: Static DNS Priority

Wed Mar 13, 2024 1:03 pm

First to be clear: static DNS records are not forwarded at all. They are answered by the router itself.
Only DNS records not in the static list are forwarded.

When you have different IP addresses for a static name, and the client asks for it, they will get all addresses in the reply.
Then, the client may pick one and when it cannot reach it pick another. That will depend on the client OS and maybe application.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3509
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Static DNS Priority

Wed Mar 13, 2024 1:38 pm

I think we're going to need more background on your question. Like what type of records are those (presumable "A", but there is also a non-standard "FWD" static entry too).

Or.... is the case here you're using DoH with nextdns.io & then listing the DoH server's hostname as 3 x /ip/dns/static? And wondering how RouterOS itself will get the IP for the configured DoH URL when there are 3 static entires for the DoH hostname (but I don't know this answer, presumably the first one)
 
User avatar
zBear
just joined
Topic Author
Posts: 23
Joined: Sat Mar 07, 2015 6:17 pm

Re: Static DNS Priority

Wed Mar 13, 2024 7:57 pm

First to be clear: static DNS records are not forwarded at all. They are answered by the router itself.
Only DNS records not in the static list are forwarded.
yes, thank you, was lost in translation :-)

When you have different IP addresses for a static name, and the client asks for it, they will get all addresses in the reply.
Then, the client may pick one and when it cannot reach it pick another. That will depend on the client OS and maybe application.
so you a saying that in my case a client will get and answer with 3 addresses and it's up to client witch one to use?
what if one of the answered addresses is not available at the time? client asks again, gets same 3 addresses, and, hopefully, picks another one? or client will choose another address "inside" the initial request?

is the case here you're using DoH with nextdns.io & then listing the DoH server's hostname as 3 x /ip/dns/static? And wondering how RouterOS itself will get the IP for the configured DoH URL when there are 3 static entires for the DoH hostname (but I don't know this answer, presumably the first one)
this is exactly what is happening, but I decided not to ask a specific question, because want to understand a logic behind picking up the static DNS entry
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3509
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Static DNS Priority  [SOLVED]

Wed Mar 13, 2024 8:42 pm

Yup, that right. The client gets all three returned at the DNS protocol level. But DNS is typically exposed to apps via gethostbyname() or modern variants, that's what's picking one of them to return. Some application (e.g. some browsers) directly speak DNS protocol so they can do their own "picking".

Thus, what RouterOS picks in DoH is unknown. But almost certain it be same result as
:put [:resolve dns.nextdns.io]
But that one fails, I'm not sure what happens to DoH. It could retry the next one in list, or it may not use the additional dns statics entires even if there is a failure.
 
User avatar
zBear
just joined
Topic Author
Posts: 23
Joined: Sat Mar 07, 2015 6:17 pm

Re: Static DNS Priority

Wed Mar 13, 2024 8:56 pm

Thus, what RouterOS picks in DoH is unknown. But almost certain it be same result as
:put [:resolve dns.nextdns.io]
for every use of this command, I receive my static addresses one after another

thank you for explanation!

Who is online

Users browsing this forum: No registered users and 10 guests