Last week, I explained the basic OS installation for the Raspberry Pi. Now that the necessary but boring steps are out of the way, we can proceed with the main event.
Install and configure the ad-blocker:
You will need to use the Linux command line for this step, but if you are not an expert at this, fear not! You will only need to enter one command. Start by clicking the icon for the terminal on Raspbian’s taskbar:
It will open a black window with a prompt. Copy the following command and paste it into the window:
curl -sSL https://install.pi-hole.net | bash
You can also find this command and additional information about the ad-blocking software at
This command sends the install script at https://install.pi-hole.net to “bash,” which is the name of the command line utility.
- Once the command appears in the window, hit ENTER. It will display some lines of text and ASCII art, then it will load into a simple graphical interface, which will guide you through the remainder of the installation process.
- The first three boxes it will show you contain some general information; read them and hit ENTER for “Ok.” The first box with options will ask you which upstream DNS provider you will use, which will provide DNS translation for all domains that aren’t blocked. My personal preference is OpenDNS. Use the up down, and right arrow keys to make your selection.
- The next box asks which IP versions to use; you should not need to make any changes here.
- You will need to pay more attention to the following window. It will ask you which IP address and gateway you want to use. My personal situation is such that I leave it as the default, but if your network is configured differently, then you will need to change these values. For example, if your router’s IP address is 192.168.0.1 instead of 192.168.1.1, you will need to change both values to reflect this. Make a note of the values you have assigned before continuing, as you will need them later.
- The next box explains that you will likely want to reserve the IP you told the Pi to use in your router’s DHCP settings. This is important, but we will get to it later.
- It will then ask if you want to install the web admin interface. I recommend doing this, but if you plan to also use the Pi as a web server, this will interfere with that.
- Finally, it will ask if you want to log queries. Sure, why not?
- It will then return to an automated section of the installation process. More exciting progress bars and scrolling text.
- One last box: this one is important, so don’t skip it. Make note of the device’s IP address if you haven’t already, the URL for the web admin page and the web admin password.
This completes the installation, reboot the Pi.
Configure your router:
This step is very important, but unfortunately, I will only be able to offer limited guidance, because the exact details will vary depending on your network configuration and router firmware.
Open your web browser, go to the URL bar and enter your router’s IP address. This will typically be 192.168.1.1 or 192.168.0.1 for most home networks.
If you entered the right address, it should present you with a login page. Enter your credentials. If you don’t know them, you will likely need to reset and reconfigure your whole router again to regain access, which is beyond the scope of this tutorial.
Once you have logged in to your router, it will likely show you a series of tabbed configuration panels.
You will need to change your DHCP reservations and your DNS server settings. On most routers I have owned, these have both been under the section for DHCP.
When you have found the DHCP reservation table, it will show you which MAC addresses (permanent network hardware identifiers) have been assigned to which IP addresses by your router. Most modern routers will show a device name as well. Make sure the Pi is assigned the IP address it was told to use during the installation process and that no other devices are assigned to that IP address.
- If you are having trouble identifying which device is your Pi in the list and don’t know it’s MAC address, go back to the Pi’s command line interface (terminal) and enter the following:
- On the fourth line of the output, it should say something similar to:
- The part with colons will be the Pi’s MAC address.
Once the DHCP reservations have been adjusted, find the DNS server setting in your router’s interface. It will likely be under the same or similar section as DHCP. Change it to the IP address you assigned to the Pi. Make sure the settings you have changed have been applied/saved. You should not need to reboot your router.
At this point, your Pi-based ad blocker should be functional. The best way to check on it is to bookmark the admin web page mentioned earlier. It will show you some statistics as well as a useful graph showing total queries vs blocked queries. If you login, it will show you more info, as well as allow you to temporarily disable the ad blocker if it is interfering with something you are trying to do.
If it does not appear to be blocking anything initially, you may need to wait awhile for the DHCP changes to take effect, and requesting more pages will give it more information to display on the graph if it is working.
In my experience so far, it has needed almost no maintenance to continue doing its job reliably, and any issues it had were fixed by simply restarting the Pi.