MikroTik (RouterOS)
RouterOS 7 has a DNS-over-HTTPS client in its resolver. The router sends every query that it forwards to your profile over HTTPS. The devices on the network keep the router as their DNS server.
Before you start, you need RouterOS 7, your profile id, and a device name
for the router (for example, mikrotik). The static entry in step 2 uses
the shared addresses of
opdns.
-
Set up the router to trust the certificate of the resolver. On RouterOS 7.19 and later, trust the built-in root store:
/certificate settings set builtin-trust-anchors=trustedOn older releases, import a CA bundle instead:
/tool fetch url=https://curl.se/ca/cacert.pem/certificate import file-name=cacert.pem passphrase="" -
Add a static entry for the DoH host. The router uses this entry to find the DoH host before DoH works:
/ip dns static add name=dns.opdns.net type=A address=23.166.164.53/ip dns static add name=dns.opdns.net type=AAAA address=2602:81f:6000::53Without this entry, RouterOS resolves the host in plain DNS through the servers in
/ip dns servers. -
Point the resolver at your profile and remove the plain upstream servers:
/ip dns set use-doh-server="https://dns.opdns.net/<profile-id>/<device>" verify-doh-cert=yes servers=""/ip dns set allow-remote-requests=yesAlso turn off Use Peer DNS on the DHCP client of your WAN interface (
/ip dhcp-client set [find] use-peer-dns=no). If you do not, the servers of your provider come back as dynamic servers. -
Make sure that LAN clients use the router. In IP → DHCP Server → Networks, set DNS Servers to the LAN address of the router. You can also keep the field empty. The router then hands out its own address.
-
Flush the cache:
/ip dns cache flushThen, from a LAN device, check that it works. Its queries appear under the device name of the router.
Limits
Section titled “Limits”- The whole network has one device name. The router makes the queries, so every LAN device appears under the name of the router. If you want a name for each device, also set up encrypted DNS on each device.
- There is no fallback. With
servers="", an outage of the resolver stops name resolution on the network. It stays stopped until you add a server again. - Devices that use their own DNS server or their own DoH bypass the router. A NAT rule that redirects outbound port 53 to the router catches the first kind. Browsers with their own DoH need their own setting (Browsers).