AdBlock DNS service with Pi-Hole

Since i receive my RPi2 i wanted to increment it’s use also as DNS AdBlock
so all my device (ipad-iphone-android phone) in my LAN could be adfree.
[ one day i will install also a l2tp VPN server so i will give this service outside my home but will be for another day ]

I found this amazing work: Instant Raspberry Pi Ad-blocker
done by : Jacob Salmela [all credit goes to him i barely made it work on osmc]

steps are simple and easy:

1: set a fixed IP to your RaspberryPI (i made a reservation on my ADSL modem DHCP server, but there are many options)

2: on the KODI interface move the webserver port from 80 to something else (8080 for example)
go to:

settings -> Service -> WebServer -> Port -> 8080

3: connect by SSH to your raspberry pi (default username: osmc password: osmc)

4: Disable the program connman that is currently listening on the DNS server port:

sudo nano /usr/bin/start-network

5: now make sure the service will not occupy the DNS port, change the line at the end of the file:

exec /usr/sbin/connmand -n --config=/etc/connman.conf


exec /usr/sbin/connmand -n --config=/etc/connman.conf --nodnsproxy

6: reboot the raspberrypi:

sudo reboot

7: install the Raspberry Pi-Hole (thanks again Jacob Salmela )

sudo curl -s “” | bash

8: now in the DHCP server of your modem set the DNS server to the IP of the raspberry pi ( AND LEAVE IT ALWAYS ON!! )

9: disconnect and reconnect your device

10: try to look at this page to check if it’s working:

Hope this will help someone else too!

1 Like

I did my own blocker instead for my router

same principle but instead of having a pi i use my router

I’m using this hosts file

and happy with result at all of my pc’s…

I’m interested to try this, but don’t want to break my OSMC setup in the process.

Specifically, I’m interested in Steps 4 and 5 and whether this is the right way to do things within the latest version of OSMC.

Has anyone recently gone through the install process?

Edit: Looks to me like steps 4 and 5 aren’t required as it appears that OSMC starts the connman service via systemd with the --nodnsproxy flag already?

I made a backup from my SD before I did the installation, but it worked from the first time like a charm! Thank you for the tutorial! =)

I have just installed this - I just ran the web script installer from and it worked fine with no issues.

The only thing I did beforehand was change the Kodi webserver to another port so the pi-hole web server can run on port 80.

Appears to be working fine so far, no errors during the install and it appears to be functioning as intended.

The only thing with the host file is that you have to set it for all devices individually and you have to update them manually.

The Pi hole updates automatically every week and it is working for all your devices that are connected to your network. So if someone uses your wifi, you don`t have to do anything for him to block adds (also less change for malware).

Also the interface, blacklisting and whitelisting is very easy with this setup see screenshots of Pi Hole web interface

The installation gave some problems here and didn’t complete.

The line 182 in the was the one going bad witch pretty much indicates that iproute was missing.

sudo apt-get install iproute

solved the problem.

You can just use the normal installer from Pi-hole after that:

curl -sSL | bash

I use a Squid transparent proxy, passing all web traffic through my server on eth0 and running the NAT on eth1. This means that all devices on my network automatically have ad blocking without any extra network configuration or DNS changes.

I use this quick script as a cronjob to keep up to date on servers to block:

wget -O /etc/squid3/ad_block.txt ''
squid3 -k reconfigure
squid3 reload is a great resource for getting a list of ad servers, and it supports exporting to multiple formats (Squid, hosts, etc).


the yolo list is alright but i like to combine lists thats why i opted for having it all in the router and setting up pixelserv so that ads turns into 1x1 transparent gif.

the bonus of having it all in the router is that all the devices in the lan are adfree :slight_smile:

At present (7 years latter), I confirm this continues being so far the best instructions to force installing Pi-hole in osmc (knowing some OSMC network features won’t work, but doesn’t matter for you at all, if you don’t make use of them).

Just point that now there are updated instructions to run Pi-hole installation in: Pi-hole · GitHub