Skip to content
Back to Blog
MikroTik

DNS Setup in MikroTik: Resolver and Static Entries

Configure MikroTik DNS resolver with upstream servers, static DNS entries, DNS cache, and filtering for your local network.

Apr 2026
8 min read

Configuring DNS on RouterOS

DNS (Domain Name System) is what allows your router and network devices to resolve domain names like google.com into IP addresses. Without proper DNS configuration, your MikroTik router will not be able to browse the internet by name, and neither will devices behind it if you use the router as their DNS server.

This guide covers everything you need to know about setting up DNS on RouterOS v7 from scratch.

Setting DNS Servers

The first step is to tell your router which DNS servers to use. These are typically provided by your ISP, but you can also use public DNS servers like Google (8.8.8.8) or Cloudflare (1.1.1.1).

TEXT
/ip dns set servers=8.8.8.8,8.8.4.4

To verify the setting:

TEXT
/ip dns print

You will see output similar to:

TEXT
      servers: 8.8.8.8,8.8.4.4
allow-remote-requests: no
    cache-size: 2048KiB
 cache-max-ttl: 1w
      cache-used: 28KiB

Enabling allow-remote-requests

By default, the router only resolves DNS for itself. If you want devices on your LAN to use the router as their DNS server, you must enable allow-remote-requests:

TEXT
/ip dns set allow-remote-requests=yes

This tells the router to accept DNS queries from other hosts on the network. Once enabled, you can point your DHCP server to hand out the router's LAN IP (e.g., 192.168.1.1) as the DNS server for clients.

Security Note

When allow-remote-requests is enabled, make sure your firewall blocks DNS queries (UDP/TCP port 53) from the WAN interface so that external hosts cannot use your router as an open DNS resolver.

TEXT
/ip firewall filter add chain=input action=drop protocol=udp dst-port=53 in-interface=ether1 comment="Block external DNS"
/ip firewall filter add chain=input action=drop protocol=tcp dst-port=53 in-interface=ether1 comment="Block external DNS TCP"

Replace ether1 with your actual WAN interface name.

Static DNS Entries

Static DNS entries let you map hostnames to specific IP addresses manually. This is useful for internal services, so that devices on your network can reach a local server by name.

TEXT
/ip dns static add name=nas.local address=192.168.1.50
/ip dns static add name=printer.local address=192.168.1.60

To view all static entries:

TEXT
/ip dns static print

You can also add CNAME-style aliases:

TEXT
/ip dns static add name=files.local cname=nas.local

DNS Caching Explained

RouterOS has a built-in DNS cache. When a client asks the router to resolve a domain, the router queries the upstream DNS server, gets the answer, and stores it locally for future requests. This reduces latency and saves bandwidth.

Cache Settings

  • cache-size: How much memory to allocate for DNS cache (default 2048 KiB).
  • cache-max-ttl: Maximum time a record is kept in cache (default 1 week). Records with shorter TTLs from the server will expire sooner.

To increase cache size:

TEXT
/ip dns set cache-size=4096KiB

To check what is currently cached:

TEXT
/ip dns cache print

To flush the DNS cache (useful after making static entry changes):

TEXT
/ip dns cache flush

Using Multiple DNS Servers

You can specify multiple DNS servers separated by commas. RouterOS will try them in order:

TEXT
/ip dns set servers=1.1.1.1,8.8.8.8,9.9.9.9

Verifying DNS Resolution

Test that DNS is working correctly from the router itself:

TEXT
/resolve google.com

This should return an IP address quickly. If it times out, check your WAN connection and your DNS server settings.

Summary

  • Set upstream DNS servers with /ip dns set servers=...
  • Enable allow-remote-requests=yes to serve DNS to LAN clients
  • Add static entries with /ip dns static add
  • Protect your DNS port from external access with firewall rules
  • Monitor and flush the cache as needed with /ip dns cache print and /ip dns cache flush

Proper DNS configuration is a foundation of a working network. Once set up, your router becomes a fast, local DNS resolver for all devices behind it.

DNS Setup in MikroTik: Resolver and Static Entries | HBZ