How to Install Pi-Hole on Your Synology NAS

How to Install Pi-Hole on Your Synology NAS

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.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Docker via Synology “Package Center”.

1 install docker synology dsm

  • STEP 3

Go to “Control Panel” and click on “Network” then set the “Server Name” to “pi-hole”. Then click “Apply”. This step is not mandatory.

2 pihole network synology dsm control panel

  • STEP 4

  1. Open Docker Package, click on “Registry” and search for “pihole”.
  2. Get the latest official “pihole/pihole” image.
  3. Download the latest pihole version.

3 download docker pihole synology

4 select the latest version of pihole synology docker

  • STEP 5

  1. Click on “Image” and double click on the downloaded image to open up the “Create Container” screen.
  2. Set the name of the container to whatever you like.
  3. Check “Execute container using high privilege” and click on the “Advanced Settings” button.

 privilege synology docker pihole advanced settings

  • STEP 6

  1. On the “Advanced Settings” screen, on the first tab – “Advanced Settings”, check – “Enable auto-restart”.
  2. Next tab – “Volume” – Click on “Add Folder”, expand the “docker” folder and create a folder called “pihole”.
  3. Under that “pihole” folder, create 2 more folders – “pihole-configs” & “dnsmasq.d-configs”.

6 Synology Docker pihole advanced settings

7 create folder pihole synology docker

  • STEP 7

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:

8 pihole etc folder synology

do the same with the other folder pihole synology

do the same with dnsmasq.d-configs “folder”.

  • STEP 8

Next tab – “Network” – Check – “Use the same network as Docker Host”. Click “Apply”.

9 network settings pi-hole synology

  • STEP 9

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.

web password and web port pihole synology

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.

  • STEP 10

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.

pihole installation final

add webpassword pihole synology

10 pihole docker installation final step

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:

Pi-Hole over VPN connections
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