Community discussions

MikroTik App
 
horstkevin
newbie
Topic Author
Posts: 26
Joined: Thu Feb 23, 2017 2:52 am

Using different external DNS-Server for different LANs

Mon Nov 20, 2023 3:05 pm

Hi there,

on a mikrotik router with Router OS 7.12 stable I have following situation:

ehter1 = WAN1
ether2 = WAN2
ether3 = LAN1 192.168.1.1 with DHCP
ether4 = LAN2 192.168.2.1 with DHCP
ether5 = LAN3 192.168.3.1 with DHCP

I want to have separated DNS-Server for each LAN, if possible.
But I cannot say in DHCP: use 8.8.8.8 for LAN1, [b]because I also need router for LAN-internal DNS function[/b].
So I have to provide 192.168.1.1 as DNS-Server in LAN1 and 192.168.2.1 as DNS-Server in LAN2.
But I need LAN1 using peer DNS of WAN1 (because of VoIP-Provider) and I want LAN2 using another external DNS via WAN2.
(For LAN3 I only need external DNS - thats what I can configure in DHCP-Server - thats clear).

So what do you mean how can this problem be solved?
Maybe mangle DNS-requests from LAN1 and route them out via WAN1? - but then DNS-lookups for internal LAN would also be routed to external DNS, right?

Thx in advance!
 
tdw
Forum Guru
Forum Guru
Posts: 2082
Joined: Sat May 05, 2018 11:55 am

Re: Using different external DNS-Server for different LANs

Mon Nov 20, 2023 3:56 pm

Mikrotik only implement a single DNS server so you are limited to the clients using that or external ones.

In your case if the WAN1 peer DNS addresses are static and the VoIP hosts to be resolved can be matched with regexp or match-subdomain you could use the WAN2 DNS servers by default with forward-to rules for the lookups which have to be made from the WAN1 DNS servers. If those requests have to originate via the correct WAN you would also need some mangle or routing rules to direct the requests accordingly.
 
LdB
Member Candidate
Member Candidate
Posts: 187
Joined: Thu May 20, 2021 4:23 pm

Re: Using different external DNS-Server for different LANs

Wed Nov 22, 2023 6:14 am

You can if you run DHCP in each LAN then on winbox under /ip/dhcp server
Goto the networks TAB

Click on the DNS box for each DHCP server you want to change and change it :-)

Obviously the tik itself has only one DNS but you can use other local ones or external.

So something like this is what you can do
Image

To try and mark it is fraught with problems and the DHCP trick is so much easier just run statics on machines as need.