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.

UPDATE 27 September 2020: This guide works perfectly with the latest Pi-Hole 5.1 release.

  • 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

  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 4

  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 5

On the “Advanced Settings” TAB check – Enable auto-restart.

6 Synology Docker pihole advanced settings

  • STEP 6

Go to File Station and open the docker folder. Inside the docker folder, create a new folder and name it “pihole“. Follow the instructions in the image below.

1 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 7

Now create two new folders inside the pihole folder that you created at STEP 7: name one pihole and the other dnsmasq.d
Follow the instructions in the image below. Once done, your folders should look like this:

2 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 8

Now go back to the Docker Package. Next tab – “Volume“. Select Add Folder. Choose the dnsmasq.d folder inside the pihole folder, then click Select. Follow the instructions in the image below.

4 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 9

After you click Select, type /etc/dnsmasq.d inside Mount path for the dnsmasq.d folder. Follow the instructions in the image below.

5 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 10

Repeat the same operation at STEP 9. Select Add Folder. Choose the pihole folder inside the pihole folder, then click Select. Follow the instructions in the image below.

6 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 11

After you click Select, type /etc/pihole inside Mount path for the pihole folder. Follow the instructions in the image below.
Your Volume will look like this:

8-pihole-etc-folder-synology

  • STEP 12

Next tab – “Network“. Choose “Use the same network as Docker Host“.

9-network-settings-pi-hole-synology

  • STEP 13

Next tab – “Environment“. Click the + to add the variable and Value. Follow the instructions in the images below.
Add the following variables and Value:
variable: WEB_PORT – Value: 8080 or 1010 or whatever you want.
variable: WEBPASSWORD – Value: Dashboard Login Password.
variable: DNSMASQ_LISTENING – Value: local.

web password and web port pihole synology

9 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 14

Edit the ServerIP variable. The default value is 0.0.0.0. You need to change this to your Synology NAS Local IP address. Click Apply.

8 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 15

After clicking “Apply“on STEP 14, the screen below will open. Click “Next“. Follow the instructions in the image below.

10 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 16

After clicking “Next“, the screen below will open. Select “Run this container after the wizard is finished” then click “Apply“. Follow the instructions in the image below.

11 Synology NAS Docker pihole advanced settings setup configuration

  • STEP 11

Go back to STEP 1 or you will deal with karma 🙂. Log in to http://Synology-ip-address:8080/admin/ using your password previously created on STEP 13 to open Pi-hole.

add webpassword pihole synology

pihole installation final

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.1 – You will automatically download the latest version when you choose “Latest” on STEP 3.

This post was updated on Monday / October 5th, 2020 at 7:29 AM