Community discussions

MikroTik App
 
MuroSiena
just joined
Topic Author
Posts: 11
Joined: Thu May 12, 2022 8:15 pm

DNS forward server for router itself

Thu May 12, 2022 10:03 pm

Hello,
I have mikrotik hcap^2 running router os 7.2.3.
I have configured ip -> dns -> servers to 100.100.100.100 (example)
DHCP servers set DNS server as router ip for dhcp clients.

I want to configure router os that DNS queries originating from router itself (update checking and etc) would be redirected to another DNS server for example 1.1.1.1
Is that possible? If yes, how I can configure that?
 
AidanAus
Member Candidate
Member Candidate
Posts: 177
Joined: Wed May 08, 2019 7:35 am
Location: Australia
Contact:

Re: DNS forward server for router itself

Fri May 13, 2022 10:19 am

Hello,
I have mikrotik hcap^2 running router os 7.2.3.
I have configured ip -> dns -> servers to 100.100.100.100 (example)
DHCP servers set DNS server as router ip for dhcp clients.

I want to configure router os that DNS queries originating from router itself (update checking and etc) would be redirected to another DNS server for example 1.1.1.1
Is that possible? If yes, how I can configure that?
destination nat would be able to do something like this, in the IP firewall nat rules what you would do is create a new entry under the dst-nat chain and then set the protocol to UDP and put the destination port number as 53. Once this is done you will need to go to the actions tab and set the action to dst-nat then in there for the dst-address you will put the server that you would like to redirect to.
 
MuroSiena
just joined
Topic Author
Posts: 11
Joined: Thu May 12, 2022 8:15 pm

Re: DNS forward server for router itself

Fri May 13, 2022 10:24 am

In this case all dns request are fowarded to specific DNS server in the dst-nat.

I want to work it only for the router itself, clients would be using entries under ip -> dns example 8.8.8.8

I have tried the rule like this, but it does not work
chain=dstnat action=dst-nat to-addresses=1.1.1.2 to-ports=53 protocol=udp src-address-type=local dst-port=53 log=yes log-prefix="dns"

I am searching a way to identify the router as a source that generates request
for example
put [resolve google.com] executed from router itself uses 1.1.1.2 instead of 8.8.8.8
 
tdw
Forum Guru
Forum Guru
Posts: 1843
Joined: Sat May 05, 2018 11:55 am

Re: DNS forward server for router itself

Fri May 13, 2022 1:56 pm

There is no way to distinguish requests as the Mikrotik is making requests on behalf of the clients, the client - Mikrotik and Mikrotik - external server requests are not directly related.

Instead of setting the DHCP server to provide the IP address of the router as the DNS server to clients you could set it to provide the address you wish them to use (so 100.100.100.100 in your example) and set the Mikrotik DNS server addresses to something else (so 1.1.1.1 in your example)
 
MuroSiena
just joined
Topic Author
Posts: 11
Joined: Thu May 12, 2022 8:15 pm

Re: DNS forward server for router itself

Fri May 13, 2022 2:10 pm

Thank you for the reply. Now it is clear for me.

Who is online

Users browsing this forum: AtomikRoach, Bing [Bot] and 55 guests