Blocking Ads for the Whole House on a NAS: What DNS Can Stop, and the YouTube Ads It Can't

I'd heard that a quick router setting could get rid of most website ads, even YouTube's. So I tried it at home, running AdGuard Home on my Synology NAS. Web and in-app ads disappeared across every device in one go. YouTube ads wouldn't budge, and I ended up dealing with them one device at a time. Here's how I set it up, the pitfalls that nearly made it all pointless, and an unexpected problem on the Apple TV.

Hi, I’m WindMori.

A while ago someone told me: “Change one setting on your router and ads disappear from a lot of websites. It even blocks YouTube ads.” I happen to have a Synology NAS that runs 24/7, so I decided to give it a try.

After a day of tinkering, the answer was: half yes, half no.

  • Ads on websites and in apps: blocked at the DNS level by AdGuard Home running on the NAS. It covers every device in the house at once, with nothing to install on any of them.
  • YouTube video ads: DNS can’t stop them. I ended up using a different approach on the Apple TV, the iPhone, and the Mac, and none of them gets rid of ads entirely. They only cut them down.

This post follows the order I actually did things in: why I chose this setup, how I deployed it, the pitfalls that nearly made it all pointless, and an unexpected detour on the YouTube side.

Why the NAS

DNS blocking is simple in principle. Before a device loads a website, it looks up the IP address for the domain. Point the whole household’s DNS at a server that filters, have it answer 0.0.0.0 for ad domains, and the ads never load.

Here’s what my home network looks like:

Fiber
  └─ ISP's ONT (also a router, 192.168.1.1)
       ├─ Nintendo Switch
       └─ TP-Link Archer AX4800 (192.168.15.1)
            ├─ Mac, iPhone, iPad, Apple TV, and every other device
            └─ Synology NAS (192.168.15.241)

Two layers of routers, with the TP-Link sitting behind the ISP’s box. The ideal place for this would be the router, but neither one works. The TP-Link’s stock firmware can’t run AdGuard Home, and the model isn’t on OpenWrt’s supported list. The ISP’s box belongs to the ISP, and I’d rather not touch it.

So the job went to the NAS. Container Manager (Synology’s built-in Docker) runs a single AdGuard Home container, and the only change on the router is the DNS server it hands out over DHCP. The NAS is always on anyway, so this costs nothing and adds no new hardware.

There’s a widely shared ad-blocking hosts list floating around online, and my first plan was to import it as-is. To be safe, I compared it line by line against AdGuard Home’s default AdGuard DNS filter, and it turned out it couldn’t be used as-is:

  • Collateral damage: mesu.g.aaplimg.com is where mesu.apple.com, Apple’s software update server, points. Block it and your iOS and macOS updates stop arriving, security updates included. clients.l.google.com is a CNAME target shared by several Google services. AdGuard Home checks CNAMEs, so blocking it takes other Google services down with it.
  • No effect: entries that list raw IP addresses (DNS can only block domains), plus two regex rules written in a syntax that matches neither AdGuard Home nor Pi-hole.
  • Long dead: Apple’s iAd domains, for example. That service shut down in 2016.
  • Already covered: doubleclick, googlesyndication, google-analytics, and the like. The default list uses rules like ||doubleclick.net^, which block every subdomain too.

In the end, only three domains were actually worth adding. Most of these lists were put together years ago and have been copied around ever since. A few minutes reading one before importing it beats hunting down why your system has stopped updating later.

Deployment: router, NAS, AdGuard Home

Router: give the NAS a fixed IP

In the TP-Link’s DHCP settings, use Address Reservation to bind the NAS’s MAC address to 192.168.15.241.

Don’t skip this. My DHCP pool is .100–.249, and .241 sits right inside it. Without a reservation, either the NAS’s IP changes one day and the whole house loses DNS, or the router hands .241 to some other device and you get a conflict.

NAS: prepare the environment and start the container

Three things to do in DSM:

  1. Install Container Manager.
  2. In Control Panel → Network, set the NAS’s own DNS manually to 1.1.1.1 and 8.8.8.8. That way the NAS doesn’t depend on AdGuard Home for its own lookups, and a problem with the container won’t knock the NAS itself offline.
  3. In the docker shared folder, create adguardhome/work and adguardhome/conf.

Then create a new project in Container Manager:

services:
  adguardhome:
    image: adguard/adguardhome:latest
    container_name: adguardhome
    network_mode: host
    restart: unless-stopped
    volumes:
      - /volume1/docker/adguardhome/work:/opt/adguardhome/work
      - /volume1/docker/adguardhome/conf:/opt/adguardhome/conf

network_mode: host is there so the query log shows each device’s real IP. On the default bridge network, every device may show up as the same internal Docker address, which makes the log much less useful.

Some people recommend Portainer for managing containers. But on Synology, Docker itself is provided by Container Manager; Portainer is just another management UI on top, and it needs docker.sock mounted and takes up an extra port. For one or two containers, Container Manager’s Projects feature is plenty.

AdGuard Home: setup wizard and settings

Open http://192.168.15.241:3000 in a browser to start the setup wizard. The web UI’s default port, 80, is already taken by Synology’s Web Station, so change it to 3000. Leave the DNS port at 53, listening on all interfaces. The wizard’s “Configure your devices” page is just information. Don’t turn AdGuard Home into a DHCP server.

Once in, here’s what I set:

  • Upstream DNS: https://dns.cloudflare.com/dns-query and https://dns.google/dns-query, with parallel requests and optimistic caching turned on.
  • Blocklists: kept the default AdGuard DNS filter and added HaGeZi’s Pro Blocklist from the built-in catalog. On the day I set it up, they had 194,673 and 247,196 rules respectively.
  • Custom rules: the three domains from earlier. The default list leaves them out on purpose to avoid breaking things, but I chose to block them. If a site ever starts looking broken, deleting the matching line undoes it.
||googletagmanager.com^
||googletagservices.com^
||2mdn.net^

Test the NAS on its own before touching the router

Before changing the router, ask the NAS directly from the Mac:

dig @192.168.15.241 ad.doubleclick.net +short   # should return 0.0.0.0
dig @192.168.15.241 example.org +short          # should return a normal IP

Ad domains came back as 0.0.0.0, ordinary sites resolved in 7 ms, and YouTube, Google, and Apple were unaffected. Time to change the router.

In the TP-Link’s DHCP settings, change the primary DNS from 1.1.1.1 to 192.168.15.241, and the secondary DNS from 8.8.8.8 to 94.140.14.14.

The secondary is AdGuard’s public DNS, which blocks ads on its own. When the NAS restarts, the house stays online and ads stay blocked. The trade-off is that those lookups don’t show up in the log and aren’t covered by the custom rules. Don’t put a non-filtering DNS like 1.1.1.1 here, or some lookups will always slip through.

Three pitfalls that nearly made it all pointless

At this point it looks done. But miss any one of the next three things and it works a lot less well than it seems.

IPv6: most Apple-device lookups were skipping the NAS

My IPv6 setup has the TP-Link passing the ISP box’s address range through to the devices below it with ND Proxy, and the IPv6 DNS it hands out is also the ISP box’s address.

And the Mac prefers IPv6 DNS. So changing only the IPv4 DNS meant most lookups from Apple devices were still going straight to the ISP’s box. The change had barely done anything.

The simplest fix is to turn off IPv6 on the TP-Link. But isn’t IPv6 faster than IPv4? I measured before switching it off:

MeasuredIPv4IPv6
Download (two runs)545–645 Mbps614–632 Mbps
Upload653 Mbps674 Mbps
Latency4–5 ms4–5 ms

The gap between them was smaller than the variation between two runs on the same protocol.

The “IPv6 is faster” you often hear in Japan is really about NTT’s FLET’S lines: there, IPv4 goes through PPPoE and gets congested at evening peak, while IPv6 uses IPoE and doesn’t. My line isn’t FLET’S. Its IPv4 never went through PPPoE and takes the same path as IPv6, so there’s no difference. If you’re on a FLET’S line, you’ll want to think this step through separately.

Keeping IPv6 and pointing its DNS at the NAS as well is certainly possible. But the NAS’s IPv6 address comes from a prefix assigned by the ISP, and if the prefix changes, that DNS setting stops working. Turning IPv6 off costs no speed, and since the TP-Link gets its IPv4 WAN address from the ISP’s box, turning it off doesn’t cut the connection and can be undone any time. So I turned it off.

Rate limit: the whole house shares 20 lookups per second

AdGuard Home has a rate limit, set to 20 requests per second by default. The catch is another default: the IPv4 subnet prefix length is 24. That means the entire 192.168.15.x network counts as one client, so dozens of devices in the house share 20 lookups per second between them.

I fired 40 concurrent queries from the Mac: 20 succeeded and 20 were simply dropped. Day to day, it shows up as a web page occasionally hanging for no obvious reason, which is hard to trace back to DNS.

After setting it to 0 (no limit), all 40 went through. Port 53 on the NAS is only open to the local network, so turning off this limit is safe.

Firewall: if it’s on, allow the ports; if it’s off, leave it off

My DSM firewall was already on, so I added an allow rule: ports 53,3000, protocol “All”, with the source limited to the 192.168.15.0/255.255.255.0 subnet.

But if your firewall was off to begin with, don’t turn it on just for this rule. The moment it’s on, anything that doesn’t match a rule falls to the default action, which can lock you out of the DSM admin page and your shared folders.

With all three sorted, reconnect the Mac and check again:

scutil --dns | grep nameserver                   # only 192.168.15.241 and 94.140.14.14 remain
dscacheutil -q host -a name ad.doubleclick.net   # ip_address: 0.0.0.0

Once the AdGuard Home dashboard starts counting queries and the household’s devices begin showing up under Top Clients, it really is done this time.

YouTube: where DNS can’t reach

YouTube serves its ads and its videos from the same set of domains, like googlevideo.com. Block by domain and the videos go with the ads.

The claims online that “after setting up my router, YouTube has no ads” are either very unreliable, or involve decrypting HTTPS at the gateway and rewriting what YouTube sends back. That requires installing a certificate on every device, which you basically can’t do on a TV, and a home router can’t do it anyway.

At home we mostly watch YouTube on the Apple TV, the iPhone, and the Mac, so I took them one at a time.

Apple TV: mute, then skip automatically

iSponsorBlockTV is a small self-hosted program. It connects to the YouTube app on the TV the same way your phone does when you use it as a remote. When an ad starts, it mutes; as soon as the “Skip ad” button appears, it presses it. It can also skip creators’ own sponsor segments, using data from SponsorBlock.

Pairing is done on a computer. I ran its setup screen on the Mac with uv:

uvx --python 3.12 iSponsorBlockTV --data ~/Downloads/isponsorblocktv --setup

In the YouTube app’s settings on the Apple TV, find “Link with TV code” and enter the number under Add Device. For skip categories, check Sponsor, Self Promotion, and Interaction, turn on Mute ads and Skip ads, and save.

Upload the resulting config.json to the NAS and keep it running with Container Manager:

services:
  isponsorblocktv:
    image: ghcr.io/dmunozv04/isponsorblocktv:latest
    container_name: isponsorblocktv
    restart: unless-stopped
    network_mode: host
    volumes:
      - /volume1/docker/isponsorblocktv/data:/app/data

It only makes outbound connections, so no firewall changes are needed. config.json contains the credentials for pairing with the TV, so don’t share it.

In practice: about 3 seconds into an ad it mutes, and at the 5-second mark, when the “Skip” button appears, it skips. Ads that can’t be skipped play out muted. Those first 3 seconds can’t be shaved off. The “an ad has started” message has to go through YouTube’s servers to reach the NAS, and the mute command goes back through YouTube’s servers to the Apple TV, so the round trip alone takes 1–3 seconds. It can only act after an ad starts; it can’t block one in advance.

Also, if your Apple TV’s audio plays through a HomePod over AirPlay, auto-mute doesn’t work. And whenever YouTube changes things, it may stop working for a while. YouTube recently changed how it transitions into ads, and related problems have already been reported on the project (#524).

The surprise: the TV went black at every ad

I thought that was the end of it. But once it was running, every ad went “mute → black screen → something like an HDMI reconnect,” chopping a single ad into several pieces. It was more annoying than before.

The cause was the Apple TV’s Match Content settings. Ads and the main video can switch between SDR and HDR, and sometimes frame rate too. Every time the Apple TV changes its output mode, the TV has to re-detect the signal. Auto-skipping meant more of those switches, so it was especially noticeable.

I tested one setting at a time. With both Match options off, the black screens went away. Turning only Match Dynamic Range back on brought them back. So it was mainly the HDR/SDR switching.

My final settings (Settings → Video and Audio):

  • Format: 4K Dolby Vision (4K HDR if your TV doesn’t support it)
  • Match Frame Rate: off
  • Match Dynamic Range: off

Now the Apple TV always outputs Dolby Vision and never switches back and forth, and HDR films keep their HDR. Regular videos and menus are converted, and the colors look normal on my TV. If yours looks washed out or too bright, switch to 4K SDR instead. The cost is that HDR films will play as regular video. With Match Frame Rate off, panning shots in 24 fps films may judder slightly, though most people probably won’t notice.

iPhone and Mac: leave it to browser extensions

  • iPhone: there’s no free, reliable way to deal with ads inside the YouTube app. I switched to watching youtube.com in Safari with uBlock Origin Lite (free, requires iOS 18 and Safari 18.6 or later). Turn it on in Settings → Apps → Safari → Extensions and allow it on all websites.
  • Mac: install uBlock Origin Lite in both Chrome and Safari (the original uBlock Origin no longer works in Chrome). If YouTube still shows ads, set the filtering mode for youtube.com to “Complete.” On Firefox, the original uBlock Origin works best.

Like iSponsorBlockTV, these extensions may stop working for a few days whenever YouTube changes something, and recover once they’re updated.

The least effort: just pay

After all that, I have to admit it: if you want YouTube ads gone completely on every device, the least effort is YouTube Premium. In Japan (as of 2026), it’s ¥1,280/month for an individual plan and ¥2,280/month for a family plan. Premium Lite, still in trial, is ¥780/month, but music and Shorts still have ads. Sign up in a browser; signing up through the iPhone app costs more.

If you do switch to Premium, you can set the Apple TV back to SDR and turn both Match options back on, which is Apple’s recommended default.

Where things ended up

Web and app adsYouTube ads
Mac✅ Blocked by the NAS✅ uBlock Origin Lite
iPhone, iPad✅ Blocked by the NAS🔸 Safari + uBlock Origin Lite; nothing works inside the app
Apple TV✅ Blocked by the NAS🔸 Mute + auto-skip
Switch (on the ISP’s box)❌ Doesn’t go through the NAS—

Two more things fall outside its reach: Safari with iCloud Private Relay turned on, and apps that use their own encrypted DNS. Both bypass the home DNS.

Day-to-day upkeep is simple. If a site or app stops working, find the blocked domain in AdGuard Home’s Query Log and click Unblock.

If you’re thinking of setting up DNS ad blocking at home with AdGuard Home, these might save you a few detours:

  • Don’t import popular hosts lists as-is. Some include entries that block system updates.
  • Give the device running AdGuard Home a fixed IP. If it’s inside the DHCP pool, set up an address reservation on the router.
  • Don’t forget IPv6. The Mac prefers IPv6 DNS, so changing only IPv4 does very little.
  • Set the rate limit to 0. By default, the whole /24 network shares 20 requests per second, and with enough devices, lookups get dropped.
  • For the secondary DNS, use a public DNS that also filters, not 1.1.1.1 or 8.8.8.8.
  • If a DNS change doesn’t seem to take effect, the DHCP lease probably just hasn’t renewed yet. Reconnect Wi-Fi or replug the cable. If a device is on both wired and wireless, reconnect both.
  • If the Apple TV goes black when ads switch, try turning off Match Dynamic Range.

Final thoughts

The most immediate change was that a lot of web pages suddenly felt cleaner and loaded a little faster. And AdGuard Home’s query log showed me, for the first time, just how many places the devices in our house quietly connect to in the background every day.

The other takeaway is a bit more skepticism toward claims like “change one setting and all the ads go away.” What DNS blocking can do is clear, and so is what it can’t. Understanding where that line is, then filling in the gaps one device at a time, feels a lot more solid than chasing a single switch that does everything.

References

  1. AdGuard Home
  2. HaGeZi DNS Blocklists
  3. iSponsorBlockTV and its installation guide
  4. Synology Knowledge Center: DSM Firewall
  5. uBlock Origin Lite (App Store)
  6. YouTube Premium Lite launches in Japan (official YouTube blog, Japanese)
Yours,WindMori