Pi-hole on a Raspberry Pi can block ads for your entire network, not just a single device, and it’s surprisingly easy to set up.
Let’s get this thing running. Grab your Raspberry Pi, an SD card, and a way to connect it to your network (Ethernet is best for stability, but Wi-Fi works too).
First, you need an operating system on your SD card. Raspberry Pi OS Lite is perfect – it’s minimal and doesn’t need a desktop environment. Download the latest version from the official Raspberry Pi website and use Raspberry Pi Imager to flash it onto your SD card. Make sure to set up your Wi-Fi credentials and enable SSH before you boot it up. This way, you can do the whole install headless (without a monitor, keyboard, or mouse attached to the Pi).
Once your Pi boots, find its IP address. You can usually do this through your router’s admin interface or by using a network scanner like nmap or arp-scan. For example, if you know your Pi’s MAC address, you can scan your network with arp-scan --localnet.
Now, connect to your Pi via SSH. The default username is pi, and the password you set in the Imager.
ssh pi@YOUR_PI_IP_ADDRESS
The Pi-hole installation is a single command. It fetches a script from the Pi-hole project and runs it. This script handles downloading Pi-hole, installing its dependencies, and guiding you through the configuration.
curl -sSL https://install.pi-hole.net | bash
The installer will walk you through a series of prompts. You’ll be asked to confirm your network interface (usually eth0 for Ethernet or wlan0 for Wi-Fi). It will then ask you to choose a DNS provider. Google’s 8.8.8.8 is a common choice, but you can pick others like Cloudflare (1.1.1.1) or OpenDNS. The key is that Pi-hole will be your local DNS server, forwarding requests to this upstream provider.
The installer will also prompt you to install the web admin interface. Say yes to this; it’s how you’ll manage Pi-hole and see your stats. Finally, it will display your Pi-hole’s IP address and the password for the web interface. Write this password down! You’ll need it immediately.
After the installation finishes, you’ll see a summary screen. It looks something like this:
[✓] DNS logging enabled
[✓] Conditional Forwarding enabled
[i] Web interface accessible via: http://YOUR_PI_IP_ADDRESS/admin
[i] Pi-hole blocking enabled
[i] Current block count: 12345
The most crucial step now is to tell your router to use Pi-hole as its DNS server. Log into your router’s administration page. Look for settings related to DHCP or DNS. You’ll want to change the DNS server address from your ISP’s default (or whatever is currently set) to your Raspberry Pi’s IP address. For example, if your Pi is at 192.168.1.100, enter that.
Once you’ve saved the router settings, you need to force your devices to get a new IP address and DNS settings. The easiest way is to reboot your router, or disconnect and reconnect each device from your network. You can also manually renew the DHCP lease on your devices. On Linux, this might be sudo dhclient -r && sudo dhclient.
Now, visit the Pi-hole web interface: http://YOUR_PI_IP_ADDRESS/admin. Log in with the password provided at the end of the installation. You should start seeing queries appear in the dashboard as devices on your network start using Pi-hole for DNS. Ads should begin disappearing from websites and apps almost immediately.
The magic happens because every device on your network is now configured to ask your Pi-hole for the IP address of a domain name (like googleads.g.doubleclick.net). Pi-hole checks this request against its blocklists. If the domain is on a blocklist, Pi-hole simply doesn’t return an IP address, effectively making the ad server unreachable. If it’s not blocked, Pi-hole forwards the request to your chosen upstream DNS provider (like Google or Cloudflare) and returns the IP address to your device.
The next step is exploring the vast array of blocklists available and customizing your Pi-hole experience with regex filtering.