This is a step-by-step guide explaining how I set up Pi-hole on a Raspberry Pi 4 for my home network, what confused me, what broke temporarily, and how I fixed it. This is written for people who are not networking experts and want something practical and honest.
1) What is a Pi-hole? (theory for nerds)
Pi-hole is a network-wide DNS blocker, but what is DNS?
DNS is not a mythical thing. In human language, DNS is the
internet’s contact list.
For example, if you type google.com.
Your computer has no clue where that is.
So it asks a DNS server:
“Hey, what number is google.com?”
And the DNS replies:
“Here. 142.250.something.something.”
Your browser then goes to that number and loads the site.
Without DNS, you would have to memorize IP addresses like a
deranged robot. Humans tried that once. It did not go well.
A DNS blocker, still in human language, is a bouncer for the
internet.
When your device asks:
“Where is ads-tracker-evil.com?”
The DNS blocker says:
“Nope. That place doesn’t exist.”
So:
- Ads
don’t load
- Trackers
don’t track
- Malware
sites never open
- Your
pages load faster
- Your
soul rests slightly easier
Instead of installing ad blockers on every device, Pi-hole
runs on one small computer (the Raspberry Pi 4 running a Linux OS) and blocks
known ad and tracking domains before they ever reach your devices.
However, a quick note: Pi-hole blocks ads, trackers,
telemetry, and analytics, but it does not reliably block YouTube ads,
especially on smart TVs.
So no, a Pi-hole will not block YouTube ads. What it does
do is avoid the leak of your personal data. Stuff like:
- “What
did this user click?”
- “How
long did they watch?”
- “What
device are they on?”
- “Send
usage stats back home”
Pi-hole blocks those calls, resulting in less spying and
less profiling.
2) Hardware and Software Setup
Hardware
- Raspberry
Pi 4 Model B (2GB RAM)
- 32GB
microSD card
- Ethernet
cable (recommended over Wi-Fi)
- HDMI
+ keyboard (only needed for initial setup)
- Case
with a fan (recommended, since it heats up)
Software
- Raspberry
Pi OS (64-bit)
- Pi-hole
(official installer)
3) Start Installation
Step 1: Install Raspberry Pi OS
a) On my computer, I installed Raspberry Pi Imager using:
https://www.raspberrypi.com/software/
b) Download Raspberry Pi OS (64-bit) from:
https://www.raspberrypi.com/software/operating-systems/
c) Insert the 32GB microSD card into the computer.
d) Open Raspberry Pi Imager and select the microSD card.
Make sure you select the correct storage device, since it will erase
everything.
e) Flash the OS (do not copy files manually). This will take
a few minutes.
f) It will ask you for:
- Hostname
- Country,
time zone, and keyboard layout
- Username
and password
- Wi-Fi
info (optional)
- Enable
SSH
After entering this information, the OS will be written to
the microSD card. This takes about 15–20 minutes.
g) Insert the microSD card into the Raspberry Pi (slot
underneath).
Step 2: First Boot
a)
Connect the Raspberry Pi to your router using an
Ethernet cable.
Use any Ethernet LAN port (usually labeled 1 to 4).
b) Connect the power cable.
c) For configuration, it is highly recommended to use an
HDMI screen and keyboard.
d) Once connected, you will see a Linux-style desktop
interface. After the initial setup, you’re ready to install Pi-hole.
Step 3: Install Pi-hole
a) Open the terminal and run:
curl -sSL https://install.pi-hole.net | sudo bash
b) The installer will start downloading packages. This may
take some time.
During installation:
- Choose
Yes to use a static IP
- Accept
“set static IP using current values”
- Select
Ethernet as the network interface
- Choose
Cloudflare as the upstream DNS provider
- Accept
the default blocklist
- Enable
query logging
- Accept
the web admin interface (you will need this later, and there is no reason
not to install it)
At the end, it will show a screen with important
information:
- IPv4
and IPv6 addresses
- Useful
links
- Admin
web interface password
Take a screenshot or save this information.
Pi-hole is now installed and running.
4) Accessing the Pi-hole Dashboard
From any device on the same network, open:
http://<PI-HOLE-IP>/admin
Log in using the password provided by Pi-hole.
Now you should see the Pi-hole dashboard.
5) Enable DHCP on Pi-hole
In the Pi-hole dashboard:
Settings → DHCP
Configured:
- DHCP
Server: ON
- IP
Range: 192.168.1.50 to 192.168.1.200
- Router
(Gateway): 192.168.1.254
- IPv6
Support: OFF
Save settings.
Now Pi-hole assigns IP addresses and DNS.
6) Add More Blocklists (Optional)
You can install more blocklists from:
https://github.com/hagezi/dns-blocklists
I am currently using several from there.
The more you install, the more load you add. Try to use
meaningful lists instead of just blocking millions of domains for no reason.
7) Configure Upstream DNS (Pi-hole)
In Settings → DNS:
Enabled:
- Cloudflare
(DNSSEC) – IPv4
Disabled:
- IPv6
- All
ECS options
This is a simple, privacy-friendly setup.
8) Disable DHCP on the Router
Since Network routers do not reliably enforce custom DNS, I
let Pi-hole handle DHCP.
On the router:
- Open
http://your.router.ip
- Log
in using the Device Access Code
- Go
to Home Network → Subnets & DHCP
- Turn
DHCP Server OFF
- Disable
IPv6
- Save
changes
IPv6 allows devices (especially TVs) to bypass Pi-hole. For
a home setup, IPv4 is more than enough.
9) Reboot Everything
This step is critical.
Reboot:
- The
router
- Reconnect
your computer’s Wi-Fi or Ethernet
Do not reboot Pi-hole. If Pi-hole is your DHCP server
and it goes down, your internet will stop working.
10) Confirm Pi-hole Is Working
In the Pi-hole dashboard:
- Clients
should appear
- Queries
should increase
- Some
domains should be blocked
If your TV shows up as a client, it’s working.
About YouTube Ads (Reality Check)
Even with a correct setup:
- YouTube
ads still appear on TVs
- Ads
and videos come from the same domains
- Pi-hole
cannot reliably block them
For browsers, use uBlock Origin.
Extra Note: Using Pi-hole with a VPN
If you use a VPN (for example, ProtonVPN):
- VPN
ON → that device bypasses Pi-hole
- VPN
OFF → Pi-hole works normally
This is expected behavior.
I use both: VPN when I’m outside my home network, and
Pi-hole when I’m at home.
Key Rules I Learned
- Exactly
one DHCP server must always be ON
- IPv6
is optional and safe to disable at home
- Pi-hole
is not a YouTube ad killer
- If
Pi-hole is your DHCP server, it must stay running
Final Thoughts
Pi-hole is:
- Excellent
for network-wide privacy
- Great
for smart TVs and IoT devices
- Educational
if you want to understand networking better
If you like technology projects, this is a good one. It’s
not hard, it teaches you how your network actually works, and it helps protect
you from the constant leaking of personal data on today’s internet.
Comentarios
Publicar un comentario