The PiHole Project
- The PiHole Official Site
- The PiHole Source Code at Github
- License: EUPL 鉂わ笍
How to block ads at home
Ads can take the user’s attention away from the content they are trying to consume, which can be frustrating.
PiHole can help us by blocking ads, improve the browsing experience and protect your privacy and security online.
Changing DNS Settings - Windows 10
setting > Network & Internet > Change adapter options
With the command line, you will be able to check if the DNS updated properly:
ipconfig /all
SelfHosting PiHole
Pre-Requisites!! Just Get Docker 馃悑馃憞
Important step and quite recommended for any SelfHosting Project - Get Docker Installed
It will be one command, this one, if you are in Linux:
apt-get update && sudo apt-get upgrade && curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh && docker version
And install also Docker-compose with:
apt install docker-compose -y
PiHole with Docker
The configuration file that we will use today is:
version: "3"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- 53:53/tcp
- 53:53/udp
- 67:67/udp
- 80:80/tcp #UI for http
- 443:443/tcp
environment:
TZ: Europe/Madrid
WEBPASSWORD: password_change_me #optional
TEMPERATUREUNIT: C
DNSMASQ_LISTENING: all #local #single #you can get DNSMASQ_WARN if not allowed are trying to query
DNSSEC: true #false
PIHOLE_DNS_: 9.9.9.9;149.112.112.112 #127.0.0.1#5053
# Volumes store your data between container upgrades
volumes:
- /home/Docker/pihole/:/etc/pihole/
- /home/Docker/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/
# Recommended but not required (DHCP needs NET_ADMIN)
cap_add:
- NET_ADMIN
restart: unless-stopped
Deploy with CLI
Providing that the previous steps are clear, we can jump to our terminal and use:
sudo nano docker-compose.yml
This will open a text editor, where we can paste the following configuration file:
To save, use CTRL+O, then CTRL+X to exit.
Then just deploy the service with:
sudo docker-compose up -d
You are ready to use PiHole, the service will be running in 0.0.0.0:80/admin
or localhost:80/admin
if you used the configuration file as it is provided.
How to configure PiHole
Testing PiHole - Is my ad-blocker working?
By default, PiHole will be blocking some adds, but how well is our new ad-blocker doing? For that we can use:
- The fantastic open source tool of d3ward: https://d3ward.github.io/toolz/adblock.html
- https://adblock-tester.com
- https://canyoublockit.com/
- https://ipleak.net/
- https://blockads.fivefilters.org/
- https://coveryourtracks.eff.org/
- http://raymondhill.net/ublock/popup.html
Tweaking PiHole - Customizing the block list
In our PiHole Admin panel, we can go to Adlists: http://192.168.3.130/admin/groups-adlists.php
-
https://raw.githubusercontent.com/d3ward/toolz/master/src/d3host.txt
-
A great consolidation of blocklists is done by WaLLy3K https://github.com/WaLLy3K and the project: https://firebog.net/ The Big Blocklist Collection
- At the moment, im using:
- https://v.firebog.net/hosts/static/w3kbl.txt
- A bigger one: https://v.firebog.net/hosts/lists.php?type=tick *with this list I achieved 92% in d3ward’s tool.
- You might also want to check: https://oisd.nl/ (Go to Setup and select Pi-Hole)
- Also, you can use regex: https://github.com/mmotti/pihole-regex
- At the moment, im using:
-
Once you added the desired ones, remember to go to Tools > Update Gravity
FAQ
How can I check if the new DNS server is working?
nslookup
#try google.com and see the DNS used
This should already give entries to the pihole dashboard at http://your_local_ip/admin/index
How to list the DNS servers used?
resolvectl status | grep "DNS Server" -A2
How to check what is using already port 53?
netstat -tulpn | grep LISTEN
or with:
sudo ss -tuln | grep :53
How can I stop systemd-resolved process at port 53?
sudo systemctl stop systemd-resolve
systemctl disable systemd-resolved.service
How to check services running?
systemctl --type=service --state=running
I had to do:
sudo systemctl stop dnsmasq.service
systemctl disable dnsmasq.service
The inet value is the ipv4 and the inet6 is the raspberry Pi IPV6
How can I check the local ip of my Android device?
Settings > Wifi > Select your Connection
> Scroll down and check IP address: You will see something like 192.168.1.111