Close

PiHole AdBlocker

 

Many websites these days do not like you using traditional ad blockers such as Adblock Plus.

Yahoo, for example will not even let you use their latest mail interface if you are using an ad blocker.

Another alternative is to use something that blocks adverts at the DNS level such as Pi-Hole, you then set your Pi-Hole as your DNS resolver making use of some known lists of ad websites and what happens is that for the majority of adverts, a zero DNS entry is returned and that simply shows as blank space.

Pi-Hole was originally developed for use on a Raspberry Pi (hence the name), however it can also be used on a stand-alone server or in a Docker container.

I chose to make use of the Docker image pihole/pihole, and additionally use the klutchell/unbound image as a local caching resolver.

The pihole configuration needs to be tweaked to make use of unbound, having the IP of the unbound container as the primary and secondary DNS resolvers.

pihole configuration:

sudo docker run -d
–name=pihole
–network web
–link unbound
–hostname pi.hole
–restart=unless-stopped
–dns=127.0.0.1
–dns=1.1.1.1
-e PUID=1001 -e PGID=1001
-e TZ=Europe/London
-e VIRTUAL_HOST=pi.hole
-e VIRTUAL_PORT=80
-e PROXY_LOCATION=pi.hole
-e WEBPASSWORD=”<password>”
-e ServerIP=192.169.99.30
-e DNS1=172.20.0.5#5053
-e DNS2=172.20.0.5#5053
-p 6080:80
-p 6443:443
-p 53:53/tcp
-p 53:53/udp
-v /Web/pihole/etc/pihole:/etc/pihole
-v /Web/pihole/etc/dnsmasq.d:/etc/dnsmasq.d/:z
-v /Web/pihole/log/pihole.log:/var/log/pihole.log
pihole/pihole

unbound configuration:

sudo docker run -d
–name=unbound
–network web
–ip=172.20.0.5
–restart=unless-stopped
-e PUID=1001 -e PGID=1001
-e TZ=Europe/London
-p 5053:5053/tcp
-p 5053:5053/udp
klutchell/unbound

Once up and running, you simply change your primary DNS resolver to be the Pi-Hole and it intercepts and removes the adverts for you.

Since I run a Ubiquiti UDM-Pro as my DHCP server, I can set this at the DHCP level so by default everyone in my house uses the Pi-Hole as their primary resolver.

I have had this working happily for a number of months now and apart from my son moaning about some of his gaming sites being blocked, it has been pretty seamless.

Leave a Reply