MikroTik RouterOS

Using Control D on MikroTik Devices.

Using Control D on MikroTik RouterOS with native DoH:

MikroTik's RouterOS has native support for DoH.

📘

As of RouterOS Version 7.19 - MikroTik has included a built-in root certificate authorities store.

Check that DNS can use the built-in Certificate Store by running the following:

/certificate/settings/print
  • RouterOS 7.21 and later: dns should be listed under current-defaults. This is the default, so you normally don't need to change anything.
  • RouterOS 7.19 and 7.20: builtin-trust-anchors should be trusted. If it isn't, run:
/certificate/settings/set builtin-trust-anchors=trusted

It's recommended to add Control D's DNS IP to your router for redundancy by running:

/ip dns set servers=76.76.2.22

Enabling DoH:

Run the following to enable your Control D DoH Resolver:

/ip dns set use-doh-server=https://dns.controld.com/$RESOLVER-ID allow-remote-requests=yes verify-doh-cert=yes

Verifying DoH:

Run ip dns print without-paging to verify your settings:

[admin@MikroTik] > ip dns print without-paging
                      servers: 76.76.2.22
              dynamic-servers:
               use-doh-server: https://dns.controld.com/$RESOLVER-ID
              verify-doh-cert: yes
   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
                          vrf: main
           mdns-repeat-ifaces:
                   cache-used: 36KiB

Testing your DoH Settings:

Let's verify that your RouterOS Device is using Control D.

  1. From the CLI run: /tool/sniffer/quick port=443 ip-address=76.76.2.22
  2. Open another Terminal and connect to your MikroTik Router without exiting the previous terminal.
  3. Run the following: :put [:resolve verify.controld.com]
  4. If successful, the second terminal prints an IP address and the first terminal shows packets to 76.76.2.22 on port 443.
  5. You can verify the query against your RouterOS Endpoint Activity Logs in the Web Dashboard.

📘

Limiting background activity to save resources:

If CRL checking is enabled (crl-use=yes), RouterOS checks the CRL for each certificate in the DoH certificate chain. On lower spec devices (like hEX S) this can cause Out-Of-Memory errors and crashes. CRL checking is off by default. Check it with /certificate/settings/print. If you turned it on and see instability, run /certificate/settings/set crl-use=no. Keep verify-doh-cert=yes either way.


Did this page help you?