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

by owenmonus in Circuits > Raspberry Pi

1471 Views, 8 Favorites, 0 Comments

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

IMG_6155.png

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)

Connect to the Internet

iu-2.png

After Logging into the Pi run the following code

sudo raspi-config

Navigate to Network Options and Select it.

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

iu-5.png
Screen Shot 2019-10-21 at 2.54.17 PM.png
iu-3.png

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.

Enable SSH

iu-4.png
iu-6.png
iu-7.jpeg

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

SSH Into Your Raspberry Pi

1 ssh.png
2ssh ed.png

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.

Installing Pi-Hole, a Network Wide Ad Blocking Service

3.2pi hole install 2.png

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

Select Interface

4wifi:eth setup.png

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

Choose Your Upstream DNS Provider

6upstream dns provider.png

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

Choose Which Databases You Want to Use to Block Ads

7.000third party lists.png

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.

Choose Which Protocols You Wish to Block Over

7.001protocols.png

I chose both.

Verify Your IP Address, Change It If You Wish

7.002network settings.png

Install Admin Web Interface

7.0003web admin interface- yes.png

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

Install the Web Server

7.004yes.png

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

Choose Wether or Not to Log Queries

7.005yes2.png

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

Package Configuration

7.006Package COnfig.png

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

Choose a Privacy Mode

7.008privacy level.png

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.

You've Successfully Setup Pi-Hole

7.009install complete.png

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

Accessing the Web Interface

dash no log in.png
pi ip adress.png

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.

Logging In

loggin in.png

Use the password from Step 16 to log in.

Logged In!!

logged in.png

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

Find Your DNS Address

where to find address.png

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.

On Your Device...

IMG_0432.PNG
IMG_0433.PNG

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

On Your Device... Cont.

IMG_0434.jpg
IMG_0435.PNG

Click the info button, and then click Configure DNS

On Your Device... Cont.

IMG_0436.jpg
IMG_0437.PNG

Change DNS to manual, and add a new one.

On Your Device... Cont.

IMG_0438.PNG

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

Results...

short time use.png

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!!