How to block ads on Youtube on Smart TV

After buying new Samsung Smart TV I noticed lot of ads on Youtube. I was surprised as on my Android phone and PC I have ads blocked (uBlock Origin for Firefox and AdAway for Android) for many years already.

First I was thinking about setting a proxy on my home router, which would block the ads. However the TV does not have any proxy settings (probably because it would help circumvent GeoIP restrictions on paid streaming content?). I would say, no problem, we have transparent proxying. However proxy in transparent mode does not support https connections, which are used on many websites (including Youtube) nowadays. So no proxy solution possible. But if anyone wants it for devices which do support proxy settings, use Privoxy package for OpenWrt and privoxy-blocklist script.

Then I have found a DNS-based solution. It works by returning modified DNS responses for domains which host ads. It is not as good as URL-based filtering, but still good enough (inc. Youtube ads, as well as video ads in SME TV application) and works for https or other protocols. I use Google DNS in my home. Its IPs are returned by my DHCP for all devices. I have manually configured TV to use DNS of my router instead. This way I can have “normal” DNS for most devices, but ad-blocking DNS for the TV.

For OpenWrt (I am using 15.05 Chaos Calmer), install package adblock (and optionally luci-app-adblock for web interface). They are not included in the repository for CC, but can be downloaded from OpenWrt’s adblock github page. There you can find also detailed installation instructions (basically just download the packages to your router and use opkg install). You can configure a cron job to automatically renew the list of blocked domains. You can also choose which blocklists to use. You can find Adblock easylist sources among the supported ones. Adding blocklists in different format is also easy, just add regexp which will filter the domain names from the list.


The whole solution works by using dnsmasq (built in OpenWrt) to return special local IP ( for ad serving domains. There is an instance of uhttpd webserver running on this IP on router, which returns empty page / empty gif for every request.

If you are not running OpenWrt on your router, the same can be accomplished on any linux machine (does not even have to be in your home network), where you will run DNS server together with the script, which will populate the list of ad domains.

Posted in Uncategorized Tagged with: , , , , , , ,
  • I’ve been using a flash blocker extension for years, in chrome and firefox. When I used to do IT support in a small company I would install the blocker extensions before handing over a computer to a new member of staff, it reduced my work load not having to reinstall computers due to web infections, and staff complaints about laggy internet when they were using mobile data.

    • David Lally

      None of which is remotely helpful for the actual topic being covered.

  • Ney CorrĂȘa

    You say a lot of shit and doesn’t help indo anything, what is the fucking dns servers you’re using for block youtube ads ? What is the fucking hosts you’re blocking indo your imaginary dns ?

  • Atty Tude

    Is it possible to get the above translated from the original geek to something approaching English with step by step instructions?

    • Marki

      I think actually you need a bit of “geek” to get this working as unfortunately this is not a plug-and-play solution.

      First you need to run an OpenWRT firmware on your router and have ssh access enabled to install the “adblock” package on your router (instructions for this are on their website).