Set up SecDNS on MikroTik RouterOS
RouterOS 7.1 introduced a native DNS-over-HTTPS client. Forwarding to SecDNS protects every device on the LAN with a single configuration change plus an optional NAT rule to catch devices that hardcode public DNS.
What you will need
- A SecDNS account
- A MikroTik device running RouterOS 7.1 or newer
- WinBox, WebFig or SSH access
- The SecDNS DoH URL
https://dns.secdns.io/dns-query/<device-id>and the matching root certificate
Setup steps
- Create a device in SecDNS. Sign in, open Devices and add a new MikroTik device. Copy the DoH URL and download the SecDNS DoH root certificate. [screenshot placeholder]
- Upload the SecDNS root certificate. In WinBox or WebFig open Files and drag the certificate into the file list. RouterOS needs this to validate the DoH TLS handshake.
- Import the certificate in the certificate store. Open System, Certificates and click Import. Select the uploaded file, then mark the certificate as Trusted so RouterOS uses it for verification. [screenshot placeholder]
- Configure DoH in IP DNS. Open IP, DNS. Set Use DoH Server to
https://dns.secdns.io/dns-query/<device-id>. Tick Verify DoH Certificate. Clear the Servers field so RouterOS uses DoH exclusively. - Add a NAT redirect for port 53. In IP, Firewall, NAT add a dstnat rule for protocol udp and tcp with dst-port 53 from the LAN interface, redirecting to the router. Duplicate the rule for IPv6 if needed.
- Test from a client. From any LAN client run
nslookup example.comor visit https://dnscheck.tools. The resolver hostname should match SecDNS infrastructure.
Verify it works
On RouterOS run /log print where topics~"dns" and look for successful DoH connections. From a LAN client https://dnscheck.tools should report SecDNS as the upstream. The SecDNS dashboard Live Logs panel fills within seconds.
Troubleshooting
- No DNS resolution after enabling DoH. RouterOS rejects DoH if certificate verification fails. Re-import the root certificate and confirm it is marked Trusted, or temporarily untick Verify DoH Certificate to confirm the URL itself works.
- Some clients still use 8.8.8.8. They are bypassing the router resolver. Confirm the NAT redirect is positioned above any generic accept rules in your firewall chain.
- High CPU when DoH is enabled. On low-end hardware (hAP lite) DoH adds noticeable CPU load. Either upgrade hardware or fall back to plain UDP/53 to the SecDNS anycast IP.
- CAPsMAN clients see different DNS than wired clients. Set DHCP Name Server explicitly on every client network rather than relying on Auto, so the same SecDNS IP is handed out everywhere.
Notes
For container-capable models (ARM Octeon, RB5009) you can run AdGuard Home in a RouterOS container and point it at SecDNS DoH, which gives you per-client filtering on top of the SecDNS policy.