For a lot of people, the hardest part about running a PiHole is generally setting up the whole thing.
This can be especially true if you're not the best networking person or are unfamiliar with the typical environment (Linux) that PiHole usually calls home.
The aim of this guide is to provide a quick and comprehensive installation and configuration of a Pi-Hole server - enough to get your PiHole up and running for your network.
For this particular guide, I'm going to assume that the following are true:
- You have an up-and-running Linux machine - ideally, any version of Raspberry Pi and its Raspbian/Rasperry Pi OS.
- You have a router where DNS/DHCP settings are changeable
- You have admin access to your router and Linux machine
If these points are not true for you, then you'll have considerable difficulty in following this particular guide.
Pi-Hole is a free, open source project. The Pi-Hole software turns your Linux device into a filtered local DNS for your entire network.
In other words: Pi-Hole lets you block the likes of ads, trackers, and malicious scripts and domains for every device connected to your network.
Why use Pihole?
Using a PiHole for your network has many benefits. Some of these include:
- Extending adblocking to your entire network - this includes Smart TVs and other smart devices
invasive trackers and tracking methods
- Blocking "phoning home" attempts that aren't configurable from devices themselves
- Blocking other telemetry/data-collection
- Reducing consumed bandwidth (due to blocking the likes of unwanted ads)
There's one thing you should do prior to actually installing PiHole; checking the IP address of your PiHole device.
The easiest way to do this is to...
- Open Terminal
- Look for your connection type. For example, if you're connected to your router via ethernet, then look for a line that begins with inet
- Here's my device's IP address:
Download and Installation
Fortunately, the developers of PiHole have made it extremely easy to install PiHole. All you really need to do to get the ball rolling is to:
- Open Terminal
curl -sSL https://install.pi-hole.net | bash
- Press Enter. Your terminal should now look something like this:
Alternatively, you can start the installation of PiHole by either manually downloading the installer itself or cloning and running the PiHole repo. This is preferable, since piping to bash can turn ugly quickly. Pi-Hole is trustworthy, so we don't have much to worry about here.
Continuing: We called the script so now the installer should be running. Your screen should look something like:
- Next up is a warning about the necessity of a static IP address. This shouldn't be an issue for most users:
- Now we have to choose an upstream DNS provider:
The upstream DNS is one of your PiHole's closest friends. What queries your PiHole can't resolve, it passes to the upstream server you choose.
While this can be changed later, I highly recommend using the one of the Quad9 filtered servers. Cloudfare is another good choice, given their recently changed stance on the privacy of their DNS service.
- Next screen. You can choose select or deselect the "stock" blocklist:
I recommend keeping it selected; you can disable it and/or add more blocklists later. (
Need blocklist recommendations?
- On the next screen, we can choose to block ads over IPv4 or IPv6. Both are selected as a default. I highly suggest to leave it this way:
- This screen allows us to confirm some network details:
The IP address shown here should be the same as whatever device you're installing PiHole on. The Gateway is the IP address of your router.
- The next screen is a warning about possible IP conflicts. The warning is straight forward.
If you have faith that your router won't assign your PiHole device's IP address to another host (which you should - otherwise you might need a new router), then you don't need to do anything.
- This screen asks if you want to install the web admin interface:
If your device runs local (and not headless), then I very super highly strongly recommend installing it. It'll make your life way easier.
- If you opted to install the web admin interface, then you'll need the supporting services to make it run. Leave it on:
- Next screen asks if we want to log queries. If you're interested in seeing what queries your devices are making, then keep this on:
- We actually get to choose how private we want our logs to be.
With that, your device should be busy installing PiHole for a little bit.
Once finished, you should get this final installer screen. Note that it has the default, randomized password for accessing the PiHole's admin interface:
Simple installing Pi-Hole isn't enough to take advantage of its tracker blocking capabilities. We'll need to make sure the devices on our network know to use our new PiHole for DNS lookups.
The best, and often most recommended, way to take advantage of your new PiHole is to set the PiHole's IP address as your router's DNS server.
Doing so makes it so that whatever device that is currently on or will (in the future) be on your network, will utilize the PiHole as the local DNS.
- Login to your router gateway. This is not your Wi-Fi password. You can usually access the router admin login page by typing the IP address of your router gateway into your browser's address bar.
- Navigate to where the DNS settings are. This location varies among interfaces/firmware and may require extensive clicking or some manual reading on your part. Here's a screenshot from the admin interface of a NetGear Router for some reference:
- Change the Primary DNS to the IP address of your PiHole device. As mentioned before, whatever device your PiHole is installed on should have a static IP address.
- You might have an option for a secondary DNS server. Leave this blank - PiHole will forward domains it can't resolve to the "upstream" DNS. Otherwise, if you configure a secondary DNS server from your router, some of your network traffic might circumvent your PiHole.
- Be sure to save your changes. In some cases, you'll have to restart your router for everything to take effect.
NOTE: Depending on your router model/manufacturer, using this method may not be possible. This is usually the case if you're using your ISP's router.
This method is not recommended - especially if your network has many devices.
Some users may be unable to configure the router to use the PiHole for DNS lookups. This can happen for a number of reasons. Two extremely common reasons are
- users unable to gain admin access to the router
- users unable to change the router's DNS configurations.
If you can't point the router to use the PiHole as the DNS server, then your other option is configuring your devices to use PiHole for DNS lookups.
Most internet enabled devices have this capability. Each device is different but you'll typically find DNS settings under the equivalent of "network settings" for many devices. Follow the documentation for the devices you are attempting to configure.
Keep in mind that going this route means you'll have to configure the DNS settings for every new device (that you want to take advantage of the PiHole) connecting to your network. Also be aware that some devices don't allow you to fiddle with DNS settings.
Your PiHole should be up and running. You may have restart a couple of devices/your router once more after pointing them to use your new PiHole set for DNS.
Remember you can access your PiHole setting interface at anytime by typing the IP address of the PiHole followed by /admin, while on the device. Headless installations would naturally use SSH to accomplish this.
Generally, the next step would be to find some reliable and well-maintained PiHole blocklists. You can either create your own or use another party's. If you need some help:
See ATH's PiHole picks.
As always, stay safe out there!