Pi-Hole is a Linux network-level advertisement and Internet tracker blocking application which acts as a DNS sinkhole (and, optionally, a DHCP server), intended for use on a private network. What is a DNS sinkhole? A DNS sinkhole, also known as a sinkhole server, Internet sinkhole, or Blackhole DNS is a DNS server that gives out false information, to prevent the use of a domain name. It is designed for use on embedded devices with network capability, such as the Raspberry Pi, but it can be used on other machines running Linux like Synology Nas and cloud implementations. Pi-Hole has the ability to block traditional website adverts as well as adverts in unconventional places, such as smart TVs and mobile operating system adverts.
I’m not a fan of applications like Pi-hole because Ad blocking software is leading to ‘the slow death of niches’ like my website. Ad blockers are white flagging Google, Amazon, Facebook and other Internet giants, but what about the small and medium publishers whose livelihood depends on ad revenues? Where is the morality in this? Anyway, see below my step by step guide on how to install Pi-Hole on your Synology NAS device. If you prefer AdGuard over Pi-Hole read my step by step guide on How to install AdGuard on your Synology NAS using docker.
Install Docker via Synology “Package Center”.
Go to “Control Panel” and click on “Network” then set the “Server Name” to “pi-hole”. Then click “Apply”. This step is not mandatory.
- Open Docker Package, click on “Registry” and search for “pihole”.
- Get the latest official “pihole/pihole” image.
- Download the latest pihole version.
- Click on “Image” and double click on the downloaded image to open up the “Create Container” screen.
- Set the name of the container to whatever you like.
- Check “Execute container using high privilege” and click on the “Advanced Settings” button.
- On the “Advanced Settings” screen, on the first tab – “Advanced Settings”, check – “Enable auto-restart”.
- Next tab – “Volume” – Click on “Add Folder”, expand the “docker” folder and create a folder called “pihole”.
- Under that “pihole” folder, create 2 more folders – “pihole-configs” & “dnsmasq.d-configs”.
Select the newly created “pihole-configs” folder and press the “Select” button. At this point, the cursor should be on the blank field under the “mount path” column. Type in /etc/pihole/
Click on Add Folder again. Navigate to the created “dnsmasq.d-configs” folder and click “Select”.
Type in /etc/dnsmasq.d/ in the “mount path” field for this.
The end result should look like this:
do the same with dnsmasq.d-configs “folder”.
Next tab – “Network” – Check – “Use the same network as Docker Host”. Click “Apply”.
Last tab – “Environment” – change “ServerIP” to your NAS’s local IP.
Add the following env variables:
WEB_PORT – Set it to something like 8080 or 1010 or whatever.
WEBPASSWORD – Dashboard Login Password.
DNS2 – This is optional, and can be set via the Dashboard and is not really necessary.
DNS1 – This is optional, and can be set via the Dashboard and is not really necessary.
Go back to STEP 1 or you will deal with karma 🙂. Log in to http://Synology-ip-address:8080/admin/ using your password to open Pi-hole.
That’s it! I hope this little guide helps you install Pi-hole on your Synology NAS.
Note: Many content providers (like YouTube / Reddit / Twitch / Spotify / Pandora / Facebook / Hulu) now stream/serve ads from the same servers as the content (meaning if you attempt to block the ads using a Pi-Hole you will also block the content).
Note: Mandatory: install a minimum of 6GB of RAM on your Synology NAS to run Pi-hole. Read my guide on How to upgrade RAM on your Synology NAS.
Note: Why do you need more RAM? To be more responsive. For sure you will not use Synology NAS just for Docker. Pi-hole needs a minimum of 512 MB of RAM (I repeat, a minimum and that’s just for Pi-hole). If anyone wants to stay within the strict minimum RAM, they are welcome to, but their system will never be as responsive as those which have more RAM installed. Why 6GB? Because most people are not professionals and they can easily install a 4 GB RAM module without opening their Synology box. An extra 4 GB RAM module, together with the pre-installed 2 GB module, adds up to 6 GB of RAM (in DS718+).
Note: Some people may have problems launching Pi-Hole via Docker. This may be because of different settings in your Synology NAS and router. Every user has their own router settings etc. It’s really hard to troubleshoot the problem. You can also contact me via email and I will try to find a personalized solution for you.
Note: After installing Pi-hole (through Docker), Synology NAS drives are not hibernating at all. The best solution is to Disable Hibernation. This will be easier and much more beneficial overall for everything Pi-hole needs to read database of filters.
Note: Find out how to update Pi-Hole container with the latest image.
Note: If someone have a problem once installation is completed, and get an error “This site can’t be reached” open the Pi-hole GUI and go to Settings / DNS tab and in “Interface listening behavior” option change to Listen on all interfaces, instead of Listen only on interface eth0. (Reported by jtd).
Note: How can I make Pi-Hole work over VPN connection? Go to Pi-Hole Preferences then check “Listen on all interfaces, permit all origins” on “Interface listening behavior”. Follow the instructions in the image below:
Note: I recommend you use Reverse Proxy to allow Pi-Hole to work over an HTTPS connection.
Note: Can I run Docker on my Synology NAS? See the supported models.
Note: The latest version of Pi-Hole is 5.0 – You will automatically download the latest version when you choose “Latest” on STEP 4.
This post was updated on