How do I install Pi-hole on a Synology NAS?


Please note that I have modified some steps for cron as they weren’t loaded properly.


I add to the white list of addresses that remains always block. And in the black list of addresses that it does not block.


Blacklist is used for blocking, whitelist for letting through.


In the white list, the site of the “” don’t unlock this for example.



ty for your guide, i successfully installed pi-hole on my syno.

But i have a problem: every time i use the web admin page warn me about a available update.

I try to re-install or pihole -up but the warn still exist…

any tips? ty

edit: pihole -v:
::: Pi-hole version is (Latest version is v2.9.4a)
::: Web-Admin version is (Latest version is v1.4.3.1a)

ok found the solution: From /etc/.pihole do a git pull


[…] Starting DNS forwarder and DHCP server: dnsmasq
dnsmasq: failed to create listening socket for port 53: Address already in use

plz. help


plz read: already in use.
ie. there is a dns server running already.


Not a linux buff in any sense and getting older so my patiance is very limited nowadays :slight_smile: but got this up and running on my Xpenology 5.xx and it is awsome!! Many thanks.

One note i would like to give to other noobs, is that i run in to error msg when installing and it was in regards to IP tables. I resolved it by adding a Firewall rule in Xpenology (through GUI). It had to do with that it needed a the files that are created when a firewall rule is set/created. By default Xpenology dosent have any rules aka the files where missing required by pi-hole. There probably are better ways of resolving this, but i’m lazy and dont mind “short cuts”.

Many thanks @bakman2 for this great tutorial!

1 Like

Followed the tutorial and have the admin page displayed in browser, but all graphics are empty. It appears I’m missing a most important file, namely /etc/pihole/setupVars.conf

I’ve run the install a few times but no change. Get error message when I run updateGravity manually too:

root@ruby:/# /usr/local/bin/pihole updateGravity
::: WARNING: /etc/pihole/setupVars.conf missing. Possible installation failure.
::: Please run ‘pihole -r’, and choose the ‘reconfigure’ option to reconfigure.

Any ideas please?


Seems the function configureFirewall() is failing in

::: Configuring iptables for httpd and dnsmasq…
modprobe: ERROR: …/libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file ‘/lib/modules/3.2.40/modules.dep.bin’
iptables v1.4.21: can’t initialize iptables table `filter’: Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.


So this line appears to be failing on my setup:

iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

I do not have the firewall enabled on my synology. In DSM (security > firewall) setting is unchecked.


from which prompt are you running your commands ?
Clearly pihole has not been installed properly, i would recommend to go into chroot and run the install again.


I’m running from chroot prompt. The script is erroring out when attempting to add entries to iptables. I commented out that part of the script (configureFirewall) so the script ran through to completion, and I’ve a working installation now. :slight_smile:


Great tutorial thank you.
How do you update Pi-hole on synology?


Hi all,

Great tutorial! For the time being everything working perfectly except the white&black listing option in the admin webpage. I can add any server from terminal, but not from web…any clue?

My config:

DSM 6.0.2-8451 Update 5
php 7.0 (beta) & 5.6 (beta) installed.


Hi bakman2, great tutorial…
I tried to run it on dsm6 (6.0.2 update 5), but dns is not reachable from other client.
I discovered that if I uninstall docker and I disable “Open vSwitch” pihole/dns start to work…
So there’s some problem with open vSwitch… I tried to let it enabled, but also if I select “ovs_eth0 (and not eth0)” as interface during pihole setup, the dns doesn’t work.
I thing that some type of port forward or port map is required… in fact, when using docker, you need to setup port forward if u want to access, for example, a web server in a container…
I don’t use docker, so I turned off open vSwitch and pihole is working again…


1 Like

Got the same problem. Tried to reinstall and uninstall multiple times

the result of install.log is
cat install.log
::: Checking if user ‘pihole’ exists…
::: User ‘pihole’ already exists
::: Installing scripts to /opt/pihole… done.
::: Installing configs…
::: Existing dnsmasq.conf found… it is from a previous pi-hole install.
::: Backing up dnsmasq.conf to dnsmasq.conf.orig… done.
::: Restoring default dnsmasq.conf… done.
::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf… done.
::: Creating log file and changing owner to dnsmasq… already exists!
::: Installing pihole custom index page… Existing page detected, not overwriting
::: Installing sudoer file… done!
::: Installing latest Cron script… done!
::: Configuring iptables for httpd and dnsmasq…

Any help is appreciated.



Did you try the reconfigure option?

pihole -r


Yup, that didn’t work either… I think there is a problem with setup because port 80 is already occupied…

I tried to install a fresh Ubuntu server and install PiHole here -and then copy the content of /etc/pihole to the Synology box, and then configure setupVars.conf with interface and ipaddress…

It seems to work… so I’ll give it a few days of testing :slight_smile:
Thanks for your effort



As i mentioned

The Pi-hole webserver runs on port 80, which is usually already occupied by the webserver, so we need to modify the webserver config:
nano /etc/lighttpd/lighttpd.conf
modify server.port = xxxx to a suitable port (higher than 1023) ctrl+x to save