Inside RouterOS there’s a DNS-level ad blocker, built in, that needs no container: it’s called adlist (/ip/dns/adlist) and it arrived with RouterOS 7.15. You feed the router’s resolver one or more lists of “bad” domains, and for every lookup that lands in a list it answers 0.0.0.0 instead of the real address. Ads and trackers (and much more, as we’ll see) never even leave the LAN.

It’s the “near-zero cost” cousin of AdGuard Home inside your MikroTik: no image to download, no disk, no device-mode — just the DNS that’s already running. In exchange you give up the web UI, per-query logs and fine-grained rules. In this howto we switch it on and take it apart piece by piece on a real CHR 7.25, with measured facts: the packets, the counters, the real errors. Including three traps almost nobody mentions.

Act 1 — Switch it on: the block, seen on the wire

First the router must act as resolver for the LAN (/ip dns set allow-remote-requests=yes) and clients must use it as their DNS. Then one line adds a list — here the famous StevenBlack unified list:

[admin@router] > /ip dns adlist add url="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" ssl-verify=no
[admin@router] > /ip dns adlist print detail
 0 url="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
   ssl-verify=no match-count=0 name-count=76118

name-count is the number of domains loaded; match-count is how many queries have been blocked so far (the hits, not the entries). Now from a client we query one domain in a list and one outside it, with the sniffer running on the router. Here are the real packets (the client is 192.168.88.10, the router 192.168.88.1):

IP 192.168.88.10.45096 > 192.168.88.1.53: 56693+ A?    doubleclick.net. (56)
IP 192.168.88.1.53 > 192.168.88.10.45096: 56693 1/0/0 A     0.0.0.0        (49)
IP 192.168.88.10.37341 > 192.168.88.1.53: 32504+ AAAA? doubleclick.net. (56)
IP 192.168.88.1.53 > 192.168.88.10.37341: 32504 1/0/0 AAAA  ::            (61)
IP 192.168.88.10.59391 > 192.168.88.1.53: 42842+ A?    example.org.    (52)
IP 192.168.88.1.53 > 192.168.88.10.59391: 42842 2/0/0 A 172.66.157.237, A 104.20.26.136 (61)

In black and white: doubleclick.net returns 0.0.0.0 for the A record and :: for the AAAA (adlist intercepts both); example.org, not in any list, returns its real addresses. A browser that receives 0.0.0.0 has nowhere to connect: the ad simply doesn’t load. And the counter rises by one for each blocked query:

[admin@router] > /ip dns adlist print detail
 0 ... match-count=6 name-count=76118     ;; 3 domains × (A+AAAA) = 6 hits

Act 2 — But that list… where does it download from? (and why ssl-verify=no is a loaded gun)

You spotted ssl-verify=no in the copy-paste command everyone uses. It means: “download the list even if I don’t trust the certificate of the site hosting it.” With ssl-verify=yes (the safe option) the download succeeds only if the server’s CA is one the router trusts — the same 27 factory root CAs we pulled out of the firmware in the howto “The root CAs hidden in the firmware”. Let’s measure it. A mirror with an untrusted certificate, verification on:

[admin@router] > /ip dns adlist add url="https://mirror.example/ads.txt" ssl-verify=yes
[admin@router] > /ip dns adlist print detail
 0 url="https://mirror.example/ads.txt" match-count=0 name-count=0

name-count=0: the list did not load. The log says exactly why — and it’s the same line from the trust-store howto:

dns,error [adlist] http client error: SSL: ssl: no trusted CA certificate found (6)

The exact same mirror with ssl-verify=no → the list loads (name-count=3). And a list served by GitHub (raw.githubusercontent.com, DigiCert certificate, which is among the firmware’s 27 roots) loads fine even with ssl-verify=yes. The lesson: ssl-verify=no is not cosmetic. That list decides what your whole network can’t reach; downloading it “from anyone, no questions asked” is the weakest link in the chain. Where the source has a serious public CA (GitHub, the big aggregators), use ssl-verify=yes. If you go with no, at least know you’re doing it. For how trust works, see the note on certificates and the chain of trust.

Act 3 — The cache trap: the list that truncates itself

This is where many setups quietly break. Adlist entries live in the DNS cache, and the cache has a ceiling. The default is small: cache-size=2048KiB. Load the StevenBlack list — which has 76,105 real entries — with that default, and watch the log:

dns,error [adlist] adlist read: max cache size reached
dns,error [adlist] could not add name, stopping import

The list got silently truncated: name-count stops at 26,761 instead of 76,118, and the cache is full (cache-used: 2001KiB of 2048) — with no room left even for ordinary response caching. Half the list is missing, and the only sign is a log line nobody watches. The cure is to raise the cache before loading big lists:

[admin@router] > /ip dns set cache-size=65536KiB
[admin@router] > /ip dns adlist reload        ;; (or re-add the list)
[admin@router] > /ip dns adlist print detail
 0 ... name-count=76118
[admin@router] > /ip dns print
      cache-size: 65536KiB
      cache-used: 5606KiB

Now the whole list fits. Rule of thumb: ~75 bytes per domain, so ~5.6 MiB per 76k entries. Size cache-size ≈ (expected names × 75 bytes) + headroom for the real cache.

Does the limit depend on the machine? Yes, and this is the subtle part. RouterOS does not validate cache-size against RAM: we asked for cache-size=2147483648KiB (2 TB) and it accepted it without blinking. It’s a “soft” ceiling: the real limit is the device’s RAM, because the cache lives entirely there. On a CHR or an x86 box with gigabytes you can load huge lists; on a small router with a few tens of MB free, the big categorized catalogs (which, as we’ll see, reach half a million domains) won’t fit. Before piling on lists, check /system resource print.

Act 4 — What formats it “eats”

Adlist is more tolerant than it looks. We loaded a mixed list from a file and queried it line by line to see what actually blocks:

0.0.0.0 tracker.example          -> blocked (0.0.0.0)
127.0.0.1 loopback.example       -> blocked (0.0.0.0)   ;; the IP in the list is ignored
255.255.255.255 broad.example    -> blocked (0.0.0.0)   ;; any IP works
bare-domain.example              -> blocked (0.0.0.0)   ;; even with no IP in front!
# this is a comment                                      ;; ignored
inline.example  # comment        -> blocked (0.0.0.0)   ;; the trailing comment is stripped
||adblock.example^               -> NOT blocked          ;; adblock syntax not supported

So: the classic hosts format works (IP domain, with any IP — the router always normalizes the answer to 0.0.0.0/::), a plain domain list works, and # comments both at line start and trailing work. What does not work is Adblock Plus syntax (||domain^): the entry is “eaten” and counts toward name-count, but it never matches a real query — it’s dead weight. When you pick a source, grab the hosts or domains variant, not the adblock one.

Act 5 — It’s not just for ads

The router treats every list the same way: the content decides the category. So beyond ads there are curated lists for trackers, malware/phishing, gambling, porn, social networks, fake news, crypto-mining. Proven on the wire: we loaded a “social” list (facebook) from The Block List Project, and facebook.com returns 0.0.0.0. And the sizes show they mean business:

facebook.txt  (social)    -> name-count=22362   facebook.com -> 0.0.0.0
gambling.txt  (gambling)  -> name-count=342623
porn.txt      (adult)     -> name-count=482591

The main sources, today (URLs may change over time — always check the project):

  • Hagezi — the most complete catalog, tiered and by category: github.com/hagezi/dns-blocklists (e.g. .../main/hosts/pro.txt, nsfw.txt, gambling.txt, tif.txt for threat-intel).
  • OISD — clean and well maintained: small.oisd.nl, big.oisd.nl, nsfw.oisd.nl.
  • The Block List Project — one list per category: raw.githubusercontent.com/blocklistproject/Lists/master/<cat>.txt (ads, tracking, malware, phishing, fraud, scam, ransomware, porn, gambling, facebook, tiktok, crypto).
  • Firebog — a categorized, annotated collection: firebog.net.
  • StevenBlack — the classic unified list + alternates (ads+social, ads+porn, fake-news…): github.com/StevenBlack/hosts.
  • Well-known single-topic lists: Peter Lowe (pgl.yoyo.org) for ads/trackers; URLhaus (urlhaus.abuse.ch) and Phishing Army for malware/phishing; NoCoin for crypto-mining.

One piece of advice: start with one well-maintained aggregated list (OISD or Hagezi) instead of stacking ten overlapping ones — less RAM, fewer false positives, less maintenance.

Act 6 — Exceptions: the whitelist almost nobody gets right

Sooner or later a list blocks something you need. The instinct: “I’ll add a /ip dns static entry with the name and the right address.” It doesn’t work. Measured: a domain in an adlist with a type-A static pointing elsewhere keeps returning 0.0.0.0 — the adlist wins over the static (even with regexp). You can prove it by removing the list: only then does the static start answering again.

The real exception is a static of type FWD: you forward that name to an upstream resolver, bypassing the list.

[admin@router] > /ip dns static add name=doubleclick.net type=FWD forward-to=8.8.8.8
[admin@router] > :put [:resolve doubleclick.net]      ;; now returns the real IP, not 0.0.0.0

Careful: the exception is per exact name. doubleclick.net is unblocked, but ad.doubleclick.net stays blocked until you unblock it too (or use match-subdomain=yes).

Two maintenance notes: you don’t need to schedule the refresh — adlist checks for updates every 4 hours on its own; /ip dns adlist reload forces a pass but only does incremental updates (it doesn’t re-download the whole list). And /ip dns adlist pause suspends all lists on the fly without deleting them, handy for diagnosing a false positive.

Act 7 — Different sets for different clients (the “parental control”)

The real case: on the kid’s PC I want to block ads and porn, on dad’s PC ads only. Two different filter sets on the same network. Can the native adlist do it? On its own, no: the adlist is a single global set tied to the router’s one resolver — it doesn’t know who is asking, it applies to everyone the same way. No per-client profiles.

The solution is architectural: you need two resolvers, one per profile, and the firewall to send each client to its own. The “strict” resolver (ads+porn) is the router’s native one; the “light” resolver (ads only) is a second resolver — a container on the router itself (a dnsmasq/unbound, or AdGuard), or an external DNS with that profile. Then the firewall steers by source:

/ip firewall address-list add list=ads-only address=192.168.88.20 comment="dad PC"
/ip firewall nat add chain=dstnat protocol=udp dst-port=53 src-address-list=ads-only \
    action=dst-nat to-addresses=192.168.88.2 to-ports=53 comment="dad -> ads-only resolver"

The kid (192.168.88.10) falls on the router’s native resolver (strict); dad (192.168.88.20) is steered to the “light” resolver at 192.168.88.2. Measured on the two resolvers, same instant, same domains:

domain                 | KID (ads+porn)    | DAD (ads only)
-----------------------+-------------------+------------------
doubleclick.net   (ad) | 0.0.0.0           | 0.0.0.0        ;; ads: blocked for both
adult-site.example     | 0.0.0.0           | 198.51.100.7   ;; porn: only the kid
example.org  (normal)  | real              | real           ;; neither one blocks

In black and white: same network, two profiles. The kid opens neither ads nor adult sites; dad keeps only the ad blocking. It works, but it must be closed off properly — otherwise it’s a fence with the gate open:

  • Force the router’s DNS. A client that sets 8.8.8.8 by hand bypasses everything: redirect all port-53 traffic to the router (dst-nat in dstnat).
  • Block DoH/DoT. Encrypted DNS (DNS-over-HTTPS, DNS-over-TLS) sidesteps the resolver: close port 853 and the known DoH resolver IPs — as in the howto on blocking encrypted DNS on RouterOS — or the “kid” gets out through the browser anyway.
  • Anchor identity not to the volatile IP but to a static DHCP lease or a dedicated VLAN: so changing one’s address isn’t enough to escape the address-list.

Two resolvers plus the firewall are a lot of moving parts for a simple result. If you genuinely need per-client — per-device profiles, with different list sets, maybe on a schedule — that’s exactly the ground of AdGuard Home in a container: there you assign a filter set to each client out of the box, with no NAT acrobatics. The native adlist is the lightweight, across-the-board option (one set for everyone); AdGuard the granular one (one set per client).

In practice — the checklist

  • Resolver on the LAN only: allow-remote-requests=yes but port 53 closed from outside in the firewall (an open resolver is an amplifier for attacks — see DNS amplification).
  • Raise cache-size in proportion to the lists, and keep an eye on RAM: no half-million-entry lists on a tiny router.
  • Use ssl-verify=yes where the source has a serious CA; start from one trusted aggregated list.
  • Whitelist = static type=FWD, per exact name. pause to diagnose.
  • Per-client = firewall + lease/VLAN + DoH/DoT blocking, or AdGuard in a container.

Appendix — essential commands

/ip dns set allow-remote-requests=yes cache-size=65536KiB
/ip dns adlist add url="https://small.oisd.nl/" ssl-verify=yes
/ip dns adlist print detail           ;; name-count (entries) and match-count (hits)
/ip dns adlist reload                 ;; incremental update (automatic every 4h)
/ip dns adlist pause                  ;; suspend/resume all lists
/ip dns static add name=site.to.unblock type=FWD forward-to=8.8.8.8   ;; whitelist
/log print where topics~"dns"         ;; diagnosis (download errors, cache full)

Frequently asked questions

Which RouterOS version introduced adlist?

Version 7.15. Before that you did it by hand with /ip dns static lists or scripts, far clunkier.

Does adlist slow the router down?

The weight is mostly in RAM (the cache), not CPU: the match happens on the resolver that’s running anyway. What you need to size is cache-size against free RAM, not processing power.

Why does a blocked site sometimes open anyway?

Three typical causes: the answer was already in the client’s or browser’s cache; the domain isn’t exactly the one in the list (often you need the right subdomain); or the device is using encrypted DNS (DoH/DoT) and bypassing the router’s resolver.

Can I see what was blocked, like in AdGuard?

Not with AdGuard’s detail: adlist gives you the match-count per list (how many queries it blocked) and the log errors, but not a per-domain register with a UI. If you want that level of visibility, that’s the use case for AdGuard Home in a container.