Recently I deployed Pi-hole in my home network to block the annoying ads. In LinkedIn, I posted the below screenshot Pi-hole dashboard, and few of my connections contacted me to post a detailed blog about Pi-hole deployment. In this blog post we will see how to deploy Pi-hole in your home network. This is not very comprehensive guide, because I couldn’t capture the screenshots of Pi-hole installation, but I have added helpful links for your reference.
Table of Contents
What is Pi-hole?
Pi-hole is basically a piece of software which will help you to block the ads network-wide. It is very powerful and I would say it is must-have in your network.
Pi-hole is free to use, easy to install, lightweight, robust, versatile and so on. More you can read it in here https://docs.pi-hole.net/
You can install Pi-hole in various operating systems, or you can use docker. I do not have Windows 10 Pro Operating System, otherwise I would have installed Pi-hole using the docker. Hence I used Raspberry Pi.
Prerequisites
As I deployed Pi-hole using Raspberry Pi, I will list the below prerequisites of my ecosystem.
- Raspberry Pi 4 Kit – this has 4 GB SD card, but I prefer to have at least 64 GB
- I got this PNY Elite-X Micro SD 128 GB in a deal, make sure you are buying Class 10 SD card for best performance
- Ethernet cable to connect Raspberry Pi with your modem/router for better connectivity
- Mouse, Keyboard, and Monitor for your Raspberry Pi
- Compatible SD Card adapter
- Windows 10 desktop/laptop
Let’s get started to deploy Pi-hole
Step 1 – Download the Raspberry Pi operating system
I installed NOOBS operating system in my 128 GB SD Card. If your SD Card is >= 64 GB, then you need to install this software as well for formatting. For more details about formatting, please check this link.
You can download the NOOBS or Raspbian operation system from here.
Download the zip file, extract it, and copy the whole folders to your SD Card. For extracting, I suggest you to use 7 zip. Default compression software in Windows 10 is terrible in unzipping.
Step 2 – Booting Raspberry Pi and Installing OS
Once the SD card is ready with the operating system, insert it in the Raspberry Pi, and power up the baby.
It will take couple minutes to boot up, and you can follow the wizard to install the operating system. It is very simple, no need to panic :).
Step 3 – Installing Pi-hole
Once the operating system is successfully installed, now it is time to install the Pi-hole.
- Launch terminal and issue the below command
curl -sSL https://install.pi-hole.net | bash
Again, the process here is simple, it will display a wizard in a DOS styled UI, you just need to follow the instruction.
But you will hit a roadblock here, it will throw an error for FTL installing. To resolve that error, issue the below command.
sudo /etc/resolv.conf
add the below lines and save the file.
nameserver 1.1.1.1
nameserver 1.0.0.1
Above is the Cloudflare’s DNS, but you can mention your favorite DNS server names.
Then issue the command curl -sSL https://install.pi-hole.net | bash
again to begin the installation process.
Also, make sure you note down the following stuffs while installing:
- Static IP address – you can reconfigure/repair using pihole -r command anytime (for complete list of commands, please refer here)
- Pi-hole admin password
You can check this guide for the screenshots and detailed instructions.
From Digital Ocean
Whenever you connect Raspberry Pi device to your router, it assigns an IP address. By default, router assigns different IP address each time you plug Raspberry Pi. But Pi-hole requires a static IP address.
There are two ways you can assign a static IP address: by setting a static IP address or by using Dynamic Host Control Protocol (DHCP).
- Login into your router. For Netgear products, you can use routerlogin.net or routerlogin.com
- Go to Advanced > Setup > LAN Setup
- In the Address Reservation section, you could see your raspberrypi
Now you can reserve the IP address only for your Raspberry Pi device.
Step 4 – Pi-hole as your DNS
It is time to use Pi-hole as your DNS. Either you can implement to all of your devices or you can use it in a specific device.
To deploy Pi-hole to your entire home network, login into your router admin page, go to DHCP Settings, enter the IP address of your Raspberry Pi as Primary DNS.
If your router doesn’t allow you to change the DHCP, you can use the settings in Pi-hole which allows you to configure the DHCP. You can check this link for more details. But usually, Pi-hole acts as a very powerful network-wide ad blocker if you configure it in the router.
Once everything went smooth, all your devices which are connected will be able to block the ads.
You can see the logs, number of clients connected, and other insights in your Pi-hole dashboard.
Useful Links
- https://pi-hole.net/
- https://www.reddit.com/r/pihole/
- https://github.com/pi-hole/pi-hole
- https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245
- https://github.com/anudeepND/whitelist – List of whitelist domains
Thanks for reading QAInsights. :)