How to Setup Pi-Hole on a Raspberry Pi, a Network Wide Ad Blocker!!

For this project, you will need:

a Raspberry Pi capable of connecting to the internet

A Micro SD card running Raspbian Lite

A Keyboard (To setup SSH)

A Second Device (To access the Web Portal)

Basic knowledge of UNIX as well as interface navigation on the Pi (which are both picked up easy and not necessarily needed if you are quick to pick things up and are smart)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Connect to the Internet

After Logging into the Pi run the following code

sudo raspi-config

Navigate to Network Options and Select it.

Step 2: Enter the Network Name (Or SSID If Your Fancy) As Well As the Password

After Clicking on network options, enter the name of your network (also known as the SSID), press enter, and then enter the password of that network, leaving it blank if there is none.

Step 3: Enable SSH

After enabling network you will be put back onto the same page. This time select Advanced Options. Then Select SSH and press enter. Hit finish and return back to the command line. Run the following to reboot your pi and apply all of the changes fully.

sudo reboot

Step 4: SSH Into Your Raspberry Pi

This allows you to use your raspberry pi from another computer. On a Mac, my computer, all you have to do is enter the IP address of your pi and the password.

ssh pi@[ip address here]

it will respond with this if you have done it correctly:

pi@[ip address here]'s password:

Enter your pi's password. The default is raspberry.

Step 5: Installing Pi-Hole, a Network Wide Ad Blocking Service

Run this command and let the pi sit for a few minutes. With any luck you'll get this interface to pop up.

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

Step 6: Select Interface

You can choose ethernet or wifi based on how your pi is connected to the internet.

Step 7: Choose Your Upstream DNS Provider

I chose cloud flare, you can choose whichever one you'd like.

Step 8: Choose Which Databases You Want to Use to Block Ads

I chose all of them, you can choose whichever you want or you can choose none, and make your own list of websites to block.

Step 9: Choose Which Protocols You Wish to Block Over

I chose both.

Step 10: Verify Your IP Address, Change It If You Wish

Step 11: Install Admin Web Interface

This is a necessity, make sure it's checked to on before proceeding.

Step 12: Install the Web Server

You need the Web server installed to access the Admin Page, so its pretty important you install it.

Step 13: Choose Wether or Not to Log Queries

Logging queries just means recording the data of page requests, check it on if you want it on.

Step 14: Package Configuration

It will configure some more packages, just go make yourself a coffee or something like that.

Step 15: Choose a Privacy Mode

From The Pi-Hole Documentation PDF:

Level 1 - Hide Domains

Show and store all domains as hidden

  • This setting disables:
    • Top Domains
    • Top Ads

Level 2 - Hide Domains and Clients

Show and store all domains as hidden and clients as 0.0.0.0

  • This setting disables:
    • Top Domains
    • Top Ads
    • Top Clients
    • Clients over time

Level 3 - Anonymous Mode (Anonymize Everything)

Disable all details except the most anonymous statistics

  • This setting disables:
    • Top Domains
    • Top Ads
    • Top Clients
    • Clients over time
    • Query Log
    • Long-term database logging


Level 4 - Disabled Statistics

Disables all statistics processing. Even the query counters will not be available. Additionally, you can disable logging to the file /var/log/pihole.log using sudo pihole logging off. Note that - due to the disabled query processing - regex blocking is not available on level 4.

Step 16: You've Successfully Setup Pi-Hole

Make note of the IP address listed as well as the password at the bottom of the prompt.

Step 17: Accessing the Web Interface

To access the web interface, enter the following into your web browser using the IP address noted from the last step.

http://[IP address of your pi]/admin/

Click login on the left side bar.

Step 18: Logging In

Use the password from Step 16 to log in.

Step 19: Logged In!!

Once logged in, click settings on the left side bar.

Step 20: Find Your DNS Address

On the settings page, under System, look for the addresses beside IPv4, and IPv6. This is your DNS server address or addresses. My internet provider doesn't have any IPv6 IP addresses, so I only have to worry about IPv4.

Step 21: On Your Device...

Go to settings or wherever you configure your internet connection. Go to your WiFi page.

Step 22: On Your Device... Cont.

Click the info button, and then click Configure DNS

Step 23: On Your Device... Cont.

Change DNS to manual, and add a new one.

Step 24: On Your Device... Cont.

Add the IPv4 and IPv6 addresses here displayed on your Pi-Hole's Settings page found in Step 20. Then delete the original one.

Step 25: Results...

After only a few minutes of browsing, tons of ads blocked. The Pi-Hole even has a live counter of ads blocked. Although it looks like my pi has missed many ads, it didn't. NO ADS at all popped up during my browsing. Its was pretty amazing. With any luck, yours will be working too!!

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    2 Discussions

    0
    None
    KeithM9

    22 days ago

    I've been using Pi-Hole for a few months now even before finding this article.

    FYI: due to the extreme amount of ad requests per page click vs. the weak processing power of the Raspberry Pi, I ultimately found the need to setup 2 of them, then my router's IP address as a custom "upstream provider" on each one of them. Apparently one Raspberry Pi couldn't honor all the DNS requests, so my computer was hitting the secondary DNS which I set for 8.8.8.8 (the Google DNS). I sacrificed a second Raspberry Pi for the greater good (setup 2 Pi-Holes) and now I get even less ads.