Running Pi-hole in a container on my Synology server to block ads everywhere in my home network on all devices

Pieter Gheysens
Into ALM
Published in
3 min readApr 15, 2020

This has already been on my to-do list for a while, but tonight I made it happen. I was afraid it would take me a lot of time but it was surprisingly quite simple to accomplish.

Photo by Robynne Hu on Unsplash

You all know how annoying it can be to see all the ads being thrown at you when surfing random pages. News websites are a typical example where articles are mixed with all kinds of banners, trying to get your attention for a potential click. Even when you are a paying customer, you still are overwhelmed with all the ads and it doesn’t matter if you use a computer, tablet or mobile phone.

Screenshot of 2 local newspapers (desktop browser view + mobile view)
No ads anymore after running Pi-hole — only the content I want to see.

Up till today I was primarily using AdBlock as a browser plugin but this solution has some disadvantages because it runs just in your computer browser and not on all devices, used by the entire family.

Logo Pi-hole
Network-wide ad blocking

Enter Pi-hole, the black hole for internet advertisements. Once you get this running on some Linux hardware (Raspbian, Ubuntu, Debian, Fedora, CentOS), it can protect all your devices from unwanted content without installing any client-side software. You will only need to run Pi-hole on your local network as a DNS resolver and it will stop web requests for bad domains.

I have been looking for reasons to finally buy a Raspberry Pi, but I believe I have to delay this purchase once again because I have found another solution to host Pi-hole.

My Synology server is capable of running Linux containers and it was an easy decision to roll this out on the pi-hole docker image. After a bit of googling I did find some pointers to configure the Docker container and afterwards I was quickly up-and-running with the Pi-hole admin web page running on a local ip address.

Pi-hole running in a Docker container on my Synology box

So, the only missing part is to configure my router to use 192.168.1.13 (my Synology IP address) as the Domain Name Server (DNS) Address instead of getting this automatically form my Internet Service Provider (ISP).

In addition to blocking all the advertisements, trackers and other crazy stuff, Pi-hole has an informative Web interface that shows all kinds of statistics on all the domains being queried on your network. The admin part provides some nice additions to fine-tune your experience.

After running it for a couple of hours, it’s simply amazing how much network traffic is being blocked. In the end, this also results in improving the network performance while having full control what to whitelist/blacklist.

Maybe one (important) task left for the future: Configuring DNS-Over-HTTPS (DoH) to browse the web securely to avoid tampering with the responses of the DNS requests.

--

--

Pieter Gheysens
Into ALM

Visual Studio ALM MVP — Managing Director Xpirit Belgium (2018) — Founder of Techorama (2014) — www.techorama.bewww.xpirit.com