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”.
- 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” TAB check – Enable auto-restart.
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.
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:
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.
After you click Select, type /etc/dnsmasq.d inside Mount path for the dnsmasq.d folder. Follow the instructions in the image below.
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.
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:
Next tab – “Network“. Choose “Use the same network as Docker Host“.
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.
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.
After clicking “Apply“on STEP 14, the screen below will open. Click “Next“. Follow the instructions in the image below.
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.
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.
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.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