How to Install Pi Hole on Raspberry Pi to Block Ads and Trackers 1

How to Install Pi Hole on Raspberry Pi to Block Ads and Trackers

The ad-based revenue model has helped online services and publishers stay functional for years. However, we cannot deny that bad trackers make it nearly impossible to keep an anonymous profile on the internet today. New fingerprinting techniques and trackers integrated into application SDKs can easily identify you in a matter of seconds. In addition, ad-heavy web pages consume significant resources and slow down the device. So if you bought a Raspberry Pi to remove all ads from your devices, this article will help you set up the Pi-hole. In this article, we have explained in detail how you can set up a Pi-hole to block ads and trackers on Raspberry Pi.

Set Pi Hole on Raspberry Pi to Block Ads and Trackers (2021)

Here we have explained the steps of setting up and operating the Pi-hole in simple terms. We used the Raspberry Pi 4 Model B in our tutorial but it will also work on older boards. You can expand the table below and easily navigate to the relevant section.

  • Plug Pi-hole into Raspberry Pi

I assume you have already set up your Raspberry Pi. If not, you can follow our tutorial and learn how to use your Windows laptop as a monitor to access and set up your Raspberry Pi if you don’t have a separate monitor. Now having said that, let’s move on to the steps.

1. First connect the Raspberry Pi to your home Wi-Fi network and open terminal. Next, run the following command. It will start installing Pi-hole on your Raspberry Pi.

sudo curl -sSL https://install.pi-hole.net | bash

2. If you are using Putty or VNC You can run the same command in Terminal window to access Raspberry Pi remotely. For example, here I am using Putty to set up Pi-hole via Raspberry Pi’s console.

Set Pi Hole on Raspberry Pi to Block Ads and Trackers (2021)

3. After the first steps are completed, Pi-hole will take you to the setup screen. Press “Enter” while viewing information about the pi-hole. Note that you can only navigate the UI via keyboard. Use the arrow keys and “Tab” to cycle through the options. And if you want to choose an option press the “Spacebar”.

Set Pi Hole on Raspberry Pi to Block Ads and Trackers (2021)

4. After a few dialogues, Pi-hole has a Static IP Address. Press the “Enter” key again.

Set Pi Hole on Raspberry Pi to Block Ads and Trackers (2021)

5. Then, “wlan0” if the Raspberry Pi is connected via Wi-Fi. And select “eth0” if you are using a wired Ethernet connection.

Set Pi Hole on Raspberry Pi to Block Ads and Trackers (2021)

6. Next, you Choose DNS provider. I usually use Google’s DNS server, but you are free to choose your own.

In relation :  How to Set Static IP Address on Raspberry Pi

Set Pi Hole on Raspberry Pi to Block Ads and Trackers (2021)

7. The next page will show that the Pi-hole is using it. Hosts of StevenBlack to block ads. Previously, there were multiple third-party hosts files, but now Pi-hole uses a combined list to reduce mismatch. You can then add more hosts files if you want. So don’t change anything and make sure the list is checked (an asterisk appears next to the list) and hit Enter.

Set Pi Hole on Raspberry Pi to Block Ads and Trackers (2021)

8. After that, select both IPv4 and IPv6 protocols. You can press the spacebar to tick both options.

Set Pi Hole on Raspberry Pi to Block Ads and Trackers (2021)

9. Next, Press “Yes” to set a static IP address to your Raspberry Pi. These steps are important to ensure that the IP address does not change constantly.

Install Pi-hole on Raspberry Pi to Block Ads and Trackers (2021)

10. On the “FYI: IP Conflict” page “OK“. We will perform one step later to resolve the IP conflict issue.

Install Pi-hole on Raspberry Pi to Block Ads and Trackers (2021)

11. After that, Choose “On” and press “OK”. This gives you access to all queries in a web interface.

Install Pi-hole on Raspberry Pi to Block Ads and Trackers (2021)

12. Similarly, “Open” and press “OK” to install the web server (lighttpd) on your Raspberry Pi.

Install Pi-hole on Raspberry Pi to Block Ads and Trackers (2021)

13. Now if you want to log queries, click “Open” and continue.

Install Pi-hole on Raspberry Pi to Block Ads and Trackers (2021)

14. In the next dialog, click “show everything” and press “OK”. It will allows you to monitor all queries and IP addresses To know where these requests are coming from. You don’t have to worry about privacy as everything happens locally on the Raspberry Pi.

Install Pi-hole on Raspberry Pi to Block Ads and Trackers (2021)

15. You are almost done now. will begin reinstallation and it will configure the Pi-hole according to your preferences on the Raspberry Pi. This step will take quite some time, so be patient.

16. After the installation is complete, a final screen will be displayed with all the details. Be sure to note”IPv4 address” (your RPi’s IP address), password and web interface address. With these details, you will be able to track all queries in your home network. Press “OK” and close the window.

Install Pi-hole on Raspberry Pi to Block Ads and Trackers (2021)

17. Now, open a web browser and enter the web interface address and hit enter. Basically, open [IP address]/admin page. If the dashboard opens, you have successfully installed Pi-hole on your Raspberry Pi. Click “Login” in the left pane and enter the password. Sign in now and you’re almost at the finish line.

Install Pi-hole on Raspberry Pi to Block Ads and Trackers (2021)

  • Configure Your Router

While everything is set up correctly, you need to change a key setting on your router. Necessary redirect all traffic to Raspberry Pi so it can filter all ads and trackers. Here’s how you can do that.

1. Enter 192.168.0.1 in a web browser on any device on your home network and press enter. As we all know, it opens the settings page of the router. Now enter the default credentials for your router and login.

Configure Your Router

2. Then, “DHCP Server” setting option. I am using a TP-Link Archer C6 router and it is available under Advanced -> Network. For other routers, it may be located under a different page, so look for it and find the settings page.

In relation :  How to Stop Personalized Ads on Google and YouTube

DHCP Server

3. When you get here, enter your Raspberry Pi’s IP address in both boxes. Primary DNS and Secondary DNS. The IPv4 address you noted in step 16 above is the IP address of your Raspberry Pi. After that, click “Save”. Now, this will redirect all traffic to Pi hole on Raspberry Pi to filter all ads and trackers. In the future, if you want to remove the Pi-hole configuration from your router, simply delete both DNS; your connection will be the same as before.

DHCP Server

4. Next, scroll down and click “address reservation” section. For other routers you will need to look for this option in different settings pages. Our need do this step to avoid any IP conflict issues. Basically, you can reserve the Raspberry Pi’s IP address so it won’t be assigned to another device on your home network.

address reservation

5. Click “Add” and enter the Raspberry Pi’s IP address in the “Reserved IP Address” field. you can find Mac Address RPi from the client list mentioned below on the same page. Next, give the “Description” field a name and tick the “Enable This Entry” checkbox. Finally, click “Save”. It will store the Raspberry Pi’s IP address.

DHCP Server

6. If you are Can’t find MAC address Open Terminal in RPi from your Raspberry Pi and run ifconfig. Check the value of “ether” under “wlan0”. This is the MAC address of your RPi.

Mac Address

7. Finally, restart your routerand changes will be applied.

  • Block Pi Hole Ads and Trackers on Raspberry Pi

1. You have installed the pi-hole and made all necessary changes. Now it’s time to see the Pi-hole in action. Open the web interface address of the pi-hole, i.e. [IP address of RPi]/admin. You can open the page on any device in the home network.

access hole

2. Now, log in and you will find the Pi-hole dashboard with all the statistics and queries directed to the Raspberry Pi.

access hole

3. Scroll down, Find the most allowed and blocked domains. Although it didn’t happen to me, if you are unable to access a website, open the Query log from the left menu and whitelist the relevant field. Moreover click on a suspicious domain and choose to blacklist.

allowed and blocked fields

4. Bottom, find all devices with a list of total and blocked requests.

device list

Disable System-Wide Ads and Trackers with Pi-hole and Raspberry Pi on Your Home Network

So you can set up Pi-hole on Raspberry Pi to block ads and trackers on your home network. The steps may seem complicated, but it’s definitely doable and you can have it working in a matter of minutes. Anyway, that’s it for us. If you run into any issues, comment below and let us know. We will surely help you.

Moyens I/O Staff has motivated you, giving you tips on technology, personal development, lifestyle and strategies that will help you.