Community discussions

MikroTik App
 
User avatar
Zilch
just joined
Topic Author
Posts: 6
Joined: Mon Mar 25, 2024 6:11 pm
Location: Kaapstad

How does RouterOS prioritize domain name servers?

Mon Mar 25, 2024 6:26 pm

Hi, all

So, say I have specified two domain name servers in my MikroTik - 8.8.8.8 first and 8.8.4.4 secondly, how would RouterOS decide which to use first?

For my application, I need RouterOS to always use the first specified server, unless it is unreachable.

If I specify those two domain name servers in my DHCP, and I have a Windows client, it will sometimes use the one, and sometimes the other. It seems to be random?

I will be running a custom domain name server, and I need RouterOS to always send queries to it, again, unless it is unreachable.

Thanks in advance.
Untitled.png
You do not have the required permissions to view the files attached to this post.
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11640
Joined: Thu Mar 03, 2016 10:23 pm

Re: How does RouterOS prioritize domain name servers?

Mon Mar 25, 2024 7:43 pm

Your wish goes against established operation and good practice.

All configured DNS servers are supposed to return same results to any query. Hence when multiple servers are configured, then DNS client (resolver) is free to use any of them with no particular affinity. Most use one server for all queries until it fails to respond [*] after which another server is used for all subsequent queries until that one fails. Etc.

[*] Failing to respond is exactly this: server doesn't answer to query. Negative answer doesn't count as failure to respond ans thus not a reason for client to query another server.

So: if one needs two DNS servers which can return answers to queries which are not globally available (e.g. LAN hosts), then one has to host two (or more) separate DNS servers on LAN (one being master for LAN zones, the rest being slaves but still authoritative) and configure the rest of LAN to use those servers.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3505
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: How does RouterOS prioritize domain name servers?

Mon Mar 25, 2024 8:08 pm

@mkx is correct. If you give a client two DNS servers via DHCP it can use either.

Now... if you client use FQDN (e.g. hostname.example.com) for stuff, and you have a custom domain with it's own DNS. You can use the Mikrotik "FWD" record in /ip/dns/static to match on a domain name & that will send queries to that server for the specified domain. But if clients are using "bare" hostname, that method won't work. And of course, the client device has use only one DNS to the Mikrotik for the "FWD" method to work. If you use Mikrotik + Google to client via DHCP, you arrive at @mkx point of how DNS resolvers works.
 
User avatar
Zilch
just joined
Topic Author
Posts: 6
Joined: Mon Mar 25, 2024 6:11 pm
Location: Kaapstad

Re: How does RouterOS prioritize domain name servers?

Tue Mar 26, 2024 6:53 pm

Ah, thanks for this. I'm relatively new to all this networking stuff.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], seriosha, yfarrokhi and 23 guests