Computing

How to block ads on every device at home with Pi-hole on a Raspberry Pi

Key takeaways

  • Pi-hole is a DNS server that refuses to look up advertising and tracking domains, so every device that uses it for DNS gets blocking without installing anything.
  • Pi-hole v6 dropped lighttpd and PHP for a web server built into FTL, keeps settings in /etc/pihole/pihole.toml and renamed the whitelist to the allowlist, so older guides give wrong commands.
  • Any Raspberry Pi with 512MB of RAM meets the official minimum; give it a fixed address with a DHCP reservation before you install.
  • Many UK ISP routers will not let you change the DNS server they hand out, so you either switch DHCP to Pi-hole or put your own router behind the ISP hub.
  • Phones and browsers set to a private DNS provider skip Pi-hole entirely, and so does IPv6 DNS from your router, which are the two most common reasons ads still appear.

This article contains affiliate links. We may earn a small commission at no extra cost to you. Details

This article contains affiliate links. We may earn a small commission at no extra cost to you. Full disclosure.

Pi-hole is free software that turns a Raspberry Pi into your home network's DNS server and refuses to look up advertising and tracking domains. Every phone, laptop, TV and console that uses it for DNS gets those requests blocked, with nothing installed on the device.

This guide covers Pi-hole v6 (core v6.4.3, July 2026) on Raspberry Pi OS. Version 6 changed enough that many older tutorials give commands that no longer exist; where a step differs, this guide says so.

What does Pi-hole actually do, and what can it not block?

Before loading anything, a device asks a DNS server to turn a name such as ad.doubleclick.net into an address. Pi-hole answers those questions. If the name is on one of its blocklists it answers with 0.0.0.0 (the default "NULL" blocking mode, per the FTL configuration docs), so the advert or tracker never loads. Everything else is passed to an upstream resolver of your choice and cached.

That design has clear limits:

  • Same-domain ads. Adverts served from the same domain as the content, YouTube being the familiar case, cannot be blocked without blocking the content too.
  • Devices that ignore your DNS. Some apps and smart TVs use their own hard-coded DNS servers, and phones or browsers set to a private DNS provider bypass Pi-hole completely (see the troubleshooting matrix below).

Treat it as a household filter for trackers and third-party ads, not a replacement for a browser blocker.

What hardware do you need, and what does it cost in the UK?

Pi-hole's official prerequisites are 512MB of RAM, at least 2GB of free storage (4GB recommended) and a supported Linux distribution such as Raspberry Pi OS, Debian or Ubuntu. Any current Raspberry Pi clears that, as does an old laptop.

OptionPrice at The Pi Hut (inc VAT, Oct 2026)Good fit if
Raspberry Pi Zero 2 W (512MB)£14.40Pi-hole only, on Wi-Fi or with a USB Ethernet adapter. Sold out when checked.
Raspberry Pi 5, 2GB£74.40Pi-hole plus one or two light services, with built-in Gigabit Ethernet
Raspberry Pi 5, 4GB£105.60You plan to add more self-hosted services later
Official 27W USB-C power supply (UK plug)£11.50Required for a Pi 5; the Zero 2 W uses micro-USB

You also need a microSD card (16GB or more leaves plenty of room) and, ideally, an Ethernet cable: a DNS server that drops off Wi-Fi takes the whole household's browsing with it. Prices change, so check before buying. If you already have a Pi 3 or 4 in a drawer, use that. You can also check Raspberry Pi 5 prices on Amazon.

Flash Raspberry Pi OS Lite with Raspberry Pi Imager, and in its customisation step set a username and turn on SSH under Remote Access. Our Raspberry Pi home server guide walks through that first boot in more detail.

How do you install Pi-hole v6 on a Raspberry Pi?

Step 1: give the Pi a fixed address

Every device will send DNS queries to the Pi, so its address must never change. Pi-hole and Raspberry Pi both recommend a DHCP reservation: find the Pi in the router's device list and reserve its address.

If your router cannot do that, set the address on the Pi itself. Current Raspberry Pi OS (Bookworm and Trixie) manages networking with NetworkManager, so the old /etc/dhcpcd.conf method no longer works. Find the connection name first, then set the address, gateway and DNS. Replace the example addresses with ones that suit your network, outside the router's DHCP range:

nmcli connection show
sudo nmcli connection modify "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.1.50/24 ipv4.gateway 192.168.1.1 ipv4.dns 1.1.1.1
sudo nmcli connection up "Wired connection 1"

Raspberry Pi's documentation warns that a mistake here can cut the Pi off the network. The Pi uses an outside resolver for its own lookups in this example; Pi-hole's post-install docs point out that if the host relies on Pi-hole and Pi-hole fails, the host cannot fetch the updates needed to repair it.

Step 2: run the installer

The official one-line installer:

curl -sSL https://install.pi-hole.net | bash

If you would rather read the script first, the installation docs also give wget and git clone alternatives.

The installer confirms your static address, asks for an upstream DNS provider (Cloudflare, Quad9 and Google are among the options) and offers Steven Black's unified hosts list as a starter blocklist. It then prints the admin password and the web address, which is http://pi.hole/admin or http://<your-pi-address>/admin.

To change the password later, v6 uses a new command. The v5 command pihole -a -p no longer exists:

sudo pihole setpassword

What changed in v6 that trips people up

  • No lighttpd or PHP. The web interface and a REST API are built into the pihole-FTL service. It binds to ports 80 and 443, and falls back to 8080 and 8443 if something else holds them.
  • One settings file. Configuration lives in /etc/pihole/pihole.toml. The docs recommend changing it through the web interface or sudo pihole-FTL --config <key> <value> rather than by hand, because those check for errors.
  • New names. The whitelist and blacklist are now the allowlist and denylist. On the command line that is pihole allow and pihole deny. In the web interface, subscribed blocklists live under Group Management, Lists and single domains under Group Management, Domains.

How do you point your devices at Pi-hole?

Pi-hole only sees queries from devices that use it as their DNS server. There are two ways to arrange that.

Option A: change the DNS server your router hands out. This is the method Pi-hole's post-install guide recommends. In the router's LAN or DHCP settings, set the DNS server to the Pi's address and nothing else. A public "secondary" DNS lets ads leak through, because devices use either.

Option B: let Pi-hole run DHCP. If the router will not let you change DNS, turn off the router's DHCP server first, then enable DHCP in Pi-hole under Settings, DHCP, setting the address range and the router's address as the gateway. Two DHCP servers on one network cause conflicts, so do it in that order.

The UK router problem. Many ISP-supplied hubs do not offer Option A. Users on the BT Community forum report that the Smart Hub 2 will not accept a custom DNS server, and the usual fix there is Option B; note that BT hubs typically use 192.168.1.254 as their address, not 192.168.1.1, so enter the right gateway. On Virgin Media's forums, users report that the Hub 5 cannot change DNS in router mode, and the workaround is modem mode plus your own router (users report modem mode is not available on the full-fibre Hub 5x). Firmware changes, so check your own hub. Failing both options, set DNS by hand on the devices that matter most.

Devices switch to Pi-hole when they renew their lease; turning Wi-Fi off and on forces that on a phone.

How do you check Pi-hole is working?

Check from a computer on the same network. Ask the Pi directly for a domain on the default list, then for a normal domain:

nslookup doubleclick.net 192.168.1.50
nslookup bbc.co.uk 192.168.1.50

The first should return 0.0.0.0 and the second a real address. If both return real addresses, the blocklist has not loaded: run pihole -g to rebuild it. Then confirm your computer is actually using the Pi without being told to:

nslookup doubleclick.net

If the "Server" line in the reply is not the Pi's address, your device is getting DNS from somewhere else. On the Pi itself, these help:

pihole status
pihole -q doubleclick.net
pihole tail

pihole status confirms blocking is on, pihole -q shows which list contains a domain, and pihole tail streams queries live. The Query Log page in the web interface shows the same, with buttons to allow or deny a domain.

Why do ads still appear, and how do you fix it?

SymptomLikely causeFix
Nothing appears in the Query Log from one deviceDevice has a manual DNS setting or kept an old DHCP leaseRemove the manual DNS, or turn Wi-Fi off and on to renew the lease
Some queries show up, ads still loadRouter also advertises its own IPv6 DNS serverTurn off IPv6 DNS advertisement on the router, or disable IPv6 on the LAN side; BT users report needing a hub restart afterwards
An Android phone never appearsPrivate DNS set to a provider hostname, which sends DNS straight to that providerSettings, Network and internet, Private DNS: choose Off or Automatic
Chrome or Edge bypasses Pi-holeSecure DNS set to a custom provider such as CloudflareSettings, Privacy and security, Security, Use secure DNS: use your current provider or turn it off
iPhone says Private Relay is off for this networkPi-hole blocks mask.icloud.com by default so Private Relay cannot bypass it, which Apple's network guidance says triggers an alertExpected behaviour; either accept it or allow the domain if you prefer Private Relay on this network
A site, app or link breaksA blocklist entry is too broad, often a tracking redirect in emailsFind the blocked domain in the Query Log, then allow it: pihole allow example.com
Smart TV or console still shows adsAds served from the same domain as the content, or hard-coded DNSNot fixable by DNS alone; a router firewall rule that redirects port 53 can help with hard-coded DNS on advanced routers
Whole network stops loading pagesPi offline, out of power or its address changedRestore the Pi, check the DHCP reservation, or temporarily set the router DNS back to automatic

By default Pi-hole also blocks Firefox's canary domain, which stops Firefox switching on DNS over HTTPS by itself; turning it on by hand still bypasses Pi-hole.

Adding blocklists and keeping Pi-hole updated

Add lists slowly: large, aggressive lists are what usually breaks sites. To add one, open Group Management, Lists, paste the list address, save, then rebuild the database:

pihole -g

The Firebog index is a widely used catalogue that marks the lists least likely to break things. Pi-hole also rebuilds gravity automatically once a week (early on Sunday morning, via its cron job), so subscribed lists stay current without you touching them.

Update Pi-hole itself, and the operating system underneath, every few weeks:

sudo apt update && sudo apt full-upgrade
pihole -up

Use Settings, Teleporter to back up your settings and lists before big changes. For wider hardening of the network Pi-hole sits on, our home network security settings guide covers router firmware, Wi-Fi and IoT isolation.

How do you undo it?

Reverse the network change first, so nothing depends on the Pi:

  1. If you used Option A, set the router's DNS back to automatic or the ISP default.
  2. If you used Option B, turn DHCP off in Pi-hole, then turn it back on in the router. Renew leases on your devices.
  3. Remove any manual DNS settings you added to individual devices.

To pause blocking without changing the network, pihole disable 5m switches it off for five minutes and pihole enable brings it back. To remove the software entirely:

pihole uninstall

If unsure, keep the system packages the uninstaller offers to remove, as the docs advise. If Pi-hole is the start of a bigger home lab, our guide to choosing a home server OS covers what to run it on next.

Frequently asked questions

Does Pi-hole block YouTube ads?

Not reliably. YouTube serves its adverts from the same domains as the videos, so a DNS blocker cannot remove one without breaking the other. Use an in-browser blocker such as uBlock Origin for YouTube.

Does Pi-hole slow down my internet?

Pi-hole answers repeat lookups from its own cache and never fetches blocked adverts at all. The main risk is the opposite one: if the Pi goes offline, devices that rely on it cannot resolve names until it is back or you change the DNS setting.

Does Pi-hole work with a BT or Virgin Media router?

Usually, but often not through the router DNS setting, because many ISP hubs do not let you change it. The common fix is to turn off DHCP on the hub and enable Pi-hole's DHCP server, or to put your own router behind the hub.

Can I use Pi-hole away from home?

Yes, if you also run a VPN such as WireGuard on your home network and point the VPN's DNS at Pi-hole. Never expose port 53 directly to the internet, because that turns Pi-hole into an open resolver.

Last checked against the Pi-hole and Raspberry Pi documentation: 11 October 2026.

More from Future Technology HQ