Quick answer: To set up Pi-hole on a Raspberry Pi, give the Pi a stable local IP address, install Pi-hole from its official installer, choose an upstream DNS provider, and then configure your router or individual devices to use the Pi as their DNS server. Before changing router settings, record the current DNS and DHCP values so you can restore service if something breaks.

Pi-hole can reduce ads and trackers across a home network, including on devices that cannot run a browser extension. The trade-off is simple: once your devices depend on the Pi for DNS, a bad address or router setting can make the internet look dead even when the connection itself is fine.

This guide walks through the complete setup, three ways to route DNS, client-side verification, realistic limitations, and an emergency rollback. It follows current Pi-hole and Raspberry Pi documentation rather than recycling screenshots from an old interface.

Watch: Set Up Pi-hole on Raspberry Pi

Prefer to see the network flow before changing your router? Watch the full Raspians walkthrough, then keep this written guide open for commands, verification steps, and the rollback checklist.

Watch Set Up Pi-hole on Raspberry Pi: Block Ads Across Your Network on YouTube

What Pi-hole does—and what it cannot do

Pi-hole is a DNS sinkhole. When a device asks where a domain lives, Pi-hole checks the requested domain against its lists. Allowed requests go to an upstream DNS resolver; selected blocked domains receive a response that prevents the normal connection. Because the filtering happens at the DNS layer, one Pi-hole can serve phones, computers, TVs, game consoles, and other clients on the same network.[1]

That does not make Pi-hole a universal ad blocker. It cannot reliably remove an ad delivered from the same domain as wanted content, inspect encrypted page content, or guarantee that every app honors your local DNS settings. It is not a firewall, VPN, antivirus product, or complete parental-control system. The thumbnail says “block ads everywhere” because thumbnails are tiny billboards; the actual technology is more specific.

Think of Pi-hole as a network-wide domain filter with useful visibility into DNS requests. The goal is not a magical blocked percentage. The goal is a setup you understand and can reverse.

What you need before installing Pi-hole

  • A supported Raspberry Pi with a reliable power supply
  • A microSD card or other supported boot medium
  • A currently maintained Raspberry Pi OS release; Lite is sufficient for a headless server
  • An Ethernet connection where practical, or stable Wi-Fi
  • Access to your router’s administration interface
  • Another device on the same network for SSH and verification
  • A password manager or another secure place for the Pi-hole administrator password

Pi-hole’s current prerequisites list 512 MB of RAM, at least 2 GB of free space with 4 GB recommended, a supported operating system, and a static address. A DHCP reservation in the router counts as a static address for this purpose.[2]

Ethernet is not mandatory, but it removes one avoidable failure point. If every device depends on this machine for DNS, a weak wireless link can become the network’s weakest link.

Pre-change checklist: record this before touching DNS

Take five minutes to write down the current configuration. Future-you will be less dramatic when the household asks why nothing loads.

  • The router’s current LAN IP address
  • The current DHCP server and address-pool settings
  • The current DNS values distributed to clients
  • The Raspberry Pi’s current IP and network interface
  • The router administrator login location—not the password in the article or a screenshot
  • A fallback public DNS resolver you trust
  • The exact steps needed to restore the old router settings

Redact hostnames, MAC addresses, public IP addresses, router credentials, and household query logs from screenshots. Pi-hole infrastructure is useful; publishing a map of your home network is not.

Step 1: Install and update Raspberry Pi OS

Use Raspberry Pi Imager to write a current Raspberry Pi OS image. For a headless Pi-hole, Raspberry Pi OS Lite keeps the installation lean. During imaging, set a unique username and strong password. Enable SSH only if you need remote administration.

Boot the Pi, connect locally or over SSH, and update the operating system:

sudo apt update
sudo apt full-upgrade
sudo reboot

After the reboot, reconnect and confirm the address:

hostname -I
ip route

If remote access is new territory, use our Raspberry Pi SSH guide. Keep SSH limited to trusted networks unless you have deliberately designed secure remote access.

Step 2: Give the Raspberry Pi a stable IP address

Pi-hole must remain at a predictable local address. Otherwise, your router can keep sending DNS traffic to yesterday’s address after the Pi moves somewhere else.

Recommended: create a DHCP reservation

In your router, find the LAN, DHCP, address reservation, or static lease section. Reserve the Pi’s current address for its Ethernet or Wi-Fi MAC address. Menu labels vary by router, so use the manufacturer’s documentation rather than forcing instructions from a different model.

A router reservation centralizes the setting and survives a Raspberry Pi OS reinstall. Pi-hole explicitly accepts a DHCP reservation as a static address.[2]

Alternative: configure the address on Raspberry Pi OS

If the router cannot reserve addresses, configure a static address using the network tools appropriate to your Raspberry Pi OS version. Recent releases use NetworkManager; older tutorials often edit dhcpcd.conf, which is not a universal current method. Our Raspberry Pi static IP guide compares the options.

Choose an unused address in the correct subnet and avoid collisions with the router’s dynamic pool. Test that the Pi remains reachable after a reboot before installing Pi-hole.

Step 3: Install Pi-hole from the official source

Pi-hole documents several installation routes. The fastest is its official one-line installer:

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

That is convenient, but piping a download directly to Bash means you do not inspect the script first. If you want to review it, download it, read it, and then run the local file:

wget -O basic-install.sh https://install.pi-hole.net
less basic-install.sh
sudo bash basic-install.sh

Pi-hole also documents a Git clone route and an official Docker deployment. Use the method you can maintain; do not copy an installer from a mirror or random blog post.[3]

Installer choices that matter

  • Network interface: select the connection that will actually stay in use.
  • Stable address: confirm the proposed address matches your reservation or static configuration.
  • Upstream DNS: choose the resolver that should answer allowed requests.
  • Web interface: enable it if you want browser-based administration.
  • Privacy and query logging: choose settings appropriate for the people and devices using the network.

Store the administrator password securely. UI labels can change between releases, so follow the current installer rather than expecting every menu to match an old screenshot.

Step 4: Make devices use Pi-hole for DNS

Installing Pi-hole does not automatically move your clients to it. You need one of the following routing approaches.

Option A: distribute Pi-hole through router DHCP

This is usually the cleanest network-wide method. Keep the router as the DHCP server, but set the DNS address it distributes to the Pi-hole’s reserved local IP. Renew client leases or reconnect devices afterward.

Pi-hole’s post-install documentation recommends configuring the router so DHCP clients use Pi-hole as their DNS server.[4] Some routers expose this as “LAN DNS,” “DHCP DNS,” or “DNS server.” Do not confuse it with the router’s WAN resolver setting unless the router documentation explicitly tells you to use that field.

Option B: use Pi-hole as the DHCP server

If your router cannot distribute a custom DNS server, Pi-hole can provide DHCP. Disable DHCP on the router before enabling it in Pi-hole. Two unplanned DHCP servers can hand clients conflicting network information and create chaos that looks random.

Write down how to re-enable router DHCP before making this change. If the Pi-hole becomes unavailable, clients may eventually lose both addressing and DNS—not a fun combo.

Option C: configure DNS on individual devices

For testing or a limited rollout, manually set one computer or phone to use the Pi-hole address. This avoids a whole-network change and makes a good pilot. The downside is maintenance: each device must be configured separately, and some devices or applications may use another resolver.

For a deeper explanation of recursive resolution and local DNS roles, see our Raspberry Pi DNS server guide.

Step 5: Verify Pi-hole from a client device

A dashboard with numbers is not proof that every device is using Pi-hole. Verify the path from a client.

  1. Renew the client’s network lease, reconnect Wi-Fi, or reboot the device.
  2. Inspect the DNS server assigned to that client. It should show the Pi-hole’s local address.
  3. Open the Pi-hole dashboard and confirm that the same client generates queries.
  4. Test one domain that should be blocked and one normal site that should be allowed.
  5. Repeat the DNS-server check on at least one other device.

On Linux, useful checks include:

resolvectl status
nslookup pi-hole.net

On macOS, inspect DNS with:

scutil --dns

Windows users can run:

ipconfig /all
nslookup pi-hole.net

The exact output varies, but the active DNS server should point to the Pi-hole for the interface under test.

Step 6: Test failure and rollback on purpose

A single Pi-hole can become a single point of failure. Test that reality while your notes are open and nobody is depending on the connection.

  1. Temporarily stop the Pi-hole service or disconnect the Pi.
  2. Try resolving a new domain from the client.
  3. Restore the Pi-hole and confirm DNS recovers.
  4. Practice the router rollback if you are confident you can restore the saved values.

Emergency rollback card

  • Restore the router’s previous DNS values or a working public resolver.
  • If Pi-hole was providing DHCP, disable Pi-hole DHCP and re-enable router DHCP.
  • Renew client leases or reconnect devices.
  • Confirm that the client has a valid address, gateway, and DNS server.
  • Troubleshoot the Pi-hole only after normal name resolution is restored.

Adding a public resolver as “secondary DNS” is not a guaranteed high-availability design. Some clients will use it directly even while Pi-hole is healthy, bypassing filtering. If DNS availability matters, plan a second resolver deliberately instead of treating the secondary field like a magic spare tire.

Common Pi-hole problems

Pi-hole is installed, but ads still appear

First confirm that the client is actually using Pi-hole. Then remember the limitation: DNS filtering cannot reliably remove ads and wanted content delivered from the same domain. Apps may also cache answers or use encrypted DNS independently.

The whole network appears offline

If IP connectivity works but domain names do not, restore the previous router DNS setting. Then check whether the Pi has the expected address, whether Pi-hole is running, and whether port 53 is available. Another DNS service on the same host can conflict with Pi-hole.[2]

Only some devices use Pi-hole

Renew DHCP leases and inspect each device’s active DNS server. Check IPv6 settings as well as IPv4. A hard-coded resolver, browser secure-DNS feature, VPN, or application-specific DNS can bypass the local setting.

The Pi-hole dashboard shows no queries

Confirm the client DNS value before changing blocklists. If it points elsewhere, fix the network path. If it points to Pi-hole, check interface selection, firewall rules, and whether DNS requests reach the Pi.

Maintenance after setup

  • Keep Raspberry Pi OS on a supported release and apply security updates.
  • Use Pi-hole’s supported update process and review release notes.
  • Back up the Pi-hole configuration after important changes.
  • Review allowlist and blocklist additions instead of piling on random lists.
  • Confirm the DHCP reservation still points to the correct interface.
  • Re-run the client-side verification after router, VPN, or DNS changes.
  • Keep a tested rollback note where another household administrator can find it.

Our Pi-hole update guide covers the update workflow, but because that article originated before Pi-hole v6, verify current commands and interface labels against Pi-hole’s documentation. For system recovery planning, see how to back up a Raspberry Pi.

Frequently asked questions

Which Raspberry Pi is best for Pi-hole?

Pi-hole is lightweight, so many supported Raspberry Pi models can run it. Reliability matters more than raw speed: use a maintained operating system, stable storage, a suitable power supply, and preferably Ethernet for a dedicated DNS service.

Does Pi-hole need a static IP address?

Yes. Clients and routers need a stable destination for DNS. Pi-hole’s prerequisites explicitly say a DHCP reservation is acceptable, which is often easier to manage than hard-coding the address on the Pi.[2]

Can Pi-hole block YouTube ads?

Not reliably. When ads and desired video content come from the same or changing domains, domain-level blocking cannot cleanly separate them. Pi-hole is not a replacement for content-aware filtering in a browser.

Will Pi-hole protect devices from malware?

Pi-hole can refuse selected domains if they appear on configured lists, but it is not antivirus software, a firewall, or a guarantee against malicious content. Keep devices patched and use appropriate security controls.

Can I run Pi-hole over Wi-Fi?

Yes, but wired Ethernet is generally more stable for a service the whole network may depend on. If Wi-Fi is the only option, use strong signal quality and reserve the correct wireless interface address.

Final setup checklist

  • Raspberry Pi OS is current and supported.
  • The Pi has a tested DHCP reservation or static address.
  • Old DNS and DHCP values are recorded.
  • Pi-hole came from an official installation route.
  • The selected interface and upstream DNS are correct.
  • Clients receive the Pi-hole address as DNS.
  • A client appears in the query log and passes blocked/allowed tests.
  • Rollback has been tested or documented clearly.
  • Passwords and household query data are not exposed.
  • Configuration backups and maintenance reminders exist.

Done properly, Pi-hole gives you more than fewer unwanted requests. It gives you a network you understand: where DNS goes, what gets filtered, what remains outside Pi-hole’s reach, and how to restore service without guessing.

Sources and further reading

  1. Raspberry Pi: Block ads at home with Pi-hole — DNS-sinkhole explanation and setup overview.
  2. Pi-hole prerequisites — supported operating systems, hardware, addressing, ports, and conflicts.
  3. Pi-hole installation documentation — official automated, clone, manual-download, and Docker routes.
  4. Pi-hole post-install documentation — router, client, and Pi-hole DHCP configuration.
  5. Raspberry Pi getting-started documentation — imaging, account setup, networking, storage, power, and updates.