Community discussions

MikroTik App
 
User avatar
f008600
just joined
Topic Author
Posts: 9
Joined: Tue Mar 05, 2024 10:33 pm
Location: Germany
Contact:

DNS setup with AdGuard and static hosts

Fri Mar 08, 2024 3:52 pm

Hi community!

I want to use the AdGuard DNS server as my primary DNS server to filter Ads. Additionally, I want to define some static hosts on my local LAN, so I do not need to remember IPs and can swap out IPs without altering configured network shares and stuff. My setup is as follows:
$> /ip/dns print
                      servers: 10.10.10.50
              dynamic-servers: 88.134.230.33,88.134.230.97
               use-doh-server: 
              verify-doh-cert: no
   doh-max-server-connections: 5
   doh-max-concurrent-queries: 50
                  doh-timeout: 5s
        allow-remote-requests: yes
          max-udp-packet-size: 4096
         query-server-timeout: 2s
          query-total-timeout: 10s
       max-concurrent-queries: 100
  max-concurrent-tcp-sessions: 20
                   cache-size: 2048KiB
                cache-max-ttl: 1w
      address-list-extra-time: 0s
                   cache-used: 46KiB

10.10.10.50 is the AdGuard DNS server, the dynamic DNS servers comes from my ISP.
I also defined some static DNS entries:
$> /ip/dns/static print
Columns: NAME, ADDRESS, TTL
# NAME             ADDRESS       TTL
;;; defconf
0 router.lan       192.168.10.1  1d 
1 core-router.lan  10.10.10.1    1d 
2 commander        10.10.10.50   1d 
When I now ping "commander", I got "Name or service not known". When I set a static route in AdGuard for the "commander" host, I got a response. The all makes sense, but I want to define the static hosts and DNS entries in my Mikrotik Router. Is there a way I can achieve this? Like using my MT-router as the default DNS server, but all DNS requests which are not listed in the static hosts got redirected to AdGuard.
 
reinerotto
Long time Member
Long time Member
Posts: 520
Joined: Thu Dec 04, 2008 2:35 am

Re: DNS setup with AdGuard and static hosts

Sat Mar 09, 2024 11:16 am

In case, you have a MT, which is officially supported to run openwrt, after flashing openwrt, you can do what you are asking for.
 
User avatar
f008600
just joined
Topic Author
Posts: 9
Joined: Tue Mar 05, 2024 10:33 pm
Location: Germany
Contact:

Re: DNS setup with AdGuard and static hosts

Sat Mar 09, 2024 11:24 am

That is not quite the answer I had hoped for :) No I want to keep the MT firmware with all my configuration.
Is this such an advanced task?
 
mszru
Frequent Visitor
Frequent Visitor
Posts: 79
Joined: Wed Aug 10, 2016 10:42 am

Re: DNS setup with AdGuard and static hosts

Sat Mar 09, 2024 11:38 am

In the IP/DHCP Server settings check what DNS addresses you give out to the clients. Most likely DNS field is blank meaning MikroTik will pass its own DNS addresses (that you see in servers and dynamic-servers of IP/DNS) to the clients. And you need to change that in a way the clients receive your router's IP as the DNS.
 
optio
Long time Member
Long time Member
Posts: 675
Joined: Mon Dec 26, 2022 2:57 pm

Re: DNS setup with AdGuard and static hosts

Sat Mar 09, 2024 3:27 pm

When I now ping "commander", I got "Name or service not known". The all makes sense, but I want to define the static hosts and DNS entries in my Mikrotik Router. Is there a way I can achieve this? Like using my MT-router as the default DNS server, but all DNS requests which are not listed in the static hosts got redirected to AdGuard.
With Pi-hole it is possible to achieve this "Conditional forwarding" using local domain, not using AdGuard, but as I see there are some options to specify upstream DNS per domain, see https://github.com/AdguardTeam/AdGuardH ... or-domains.
Create in ROS static DNS entries hosts with some local domain like commander.lan and also setup in AdGuard ROS IP as upstream DNS for local domain which it will be used (eg. lan).
Then use for resolving host.domain, not just host name, eg. ping commander.lan.
 
User avatar
f008600
just joined
Topic Author
Posts: 9
Joined: Tue Mar 05, 2024 10:33 pm
Location: Germany
Contact:

Re: DNS setup with AdGuard and static hosts

Mon Mar 11, 2024 12:14 am

Thanks optio, defining an upstream for a specific domain works fine!

Who is online

Users browsing this forum: akakua, Pilo2710, qatar2022 and 23 guests