SecDNS

Set up SecDNS on MikroTik RouterOS with DoH forwarding

Configure MikroTik RouterOS to forward every LAN DNS query over encrypted DoH to SecDNS, with per-network filtering and audit logs in fifteen minutes.

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

  1. 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]
  2. 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.
  3. 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]
  4. 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.
  5. 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.
  6. Test from a client. From any LAN client run nslookup example.com or 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.

Frequently asked questions

Which RouterOS versions support DoH?

RouterOS 7.1 and later includes a native DoH client. RouterOS 6 cannot do DoH directly; on legacy hardware install Pi-hole or AdGuard Home on a small device on the LAN and point it at SecDNS DoH.

Do I have to upload a certificate?

RouterOS by default does not trust any CAs. Importing the SecDNS DoH root certificate lets RouterOS validate the TLS chain. Skipping it means turning off Verify DoH Certificate, which is not recommended.

Will the NAT redirect break Wi-Fi calling or IoT devices?

Wi-Fi calling uses its own resolution path and should be unaffected. Some IoT devices misbehave if their hardcoded DNS request is rewritten; whitelist their MAC address in the firewall if needed.

Can I run different SecDNS profiles per VLAN?

Yes. Create one SecDNS device per VLAN. Bind each VLAN to a separate vrf or routing table and point each vrf's IP DNS at a different DoH URL.

What about CAPsMAN-managed APs?

CAPsMAN APs inherit DNS from clients, not from the CAP itself. Set DHCP Name Server on the client networks to the MikroTik LAN IP and the change propagates everywhere.