Skip to main content
Print

Pi-hole and Home Assistant: Network-Wide Ad Blocking

Pi-hole blocks many adverts and tracking domains for devices across your network by answering DNS requests before they reach the normal DNS resolver. Home Assistant can monitor and control it once it is running.

How Pi-hole works

When a web page wants content from an advertising domain, your device normally asks DNS for that domain’s address. Pi-hole compares the request against block lists and prevents known advertising/tracking domains from resolving normally.

1. Give the Pi-hole server a fixed address

Your network needs to know where its DNS server lives, so do not leave the Pi-hole host on an address that may unexpectedly change.

2. Install Pi-hole

Install Pi-hole on a suitable Linux host and follow the installer. Choose an upstream DNS provider and enable the block list. Record the admin interface address and secure the admin account.

3. Point devices at Pi-hole

The best network-wide setup is normally to configure your router/DHCP service to hand out the Pi-hole address as DNS. Router interfaces vary, so check the instructions for your own router. For testing, you can manually change DNS on one computer first.

4. Test before changing the whole network

Visit a site that normally contains adverts and confirm that Pi-hole is receiving queries. Remember that DNS information is cached, so changes may not appear instantly.

5. Add Pi-hole to Home Assistant

Go to Settings → Devices & services → Add integration, search for Pi-hole and provide the Pi-hole host details requested by Home Assistant.

6. Optional dashboard card

A Pi-hole card from HACS can provide a convenient dashboard view, including query statistics and controls for temporarily disabling blocking when a site genuinely needs it.

Important limitation

DNS blocking cannot remove every advert. If advertising content comes from the same domain as the content you actually want, blocking the domain would break the service as well.

Watch the walkthrough

Table of Contents