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!!
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
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
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
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
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
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
You can choose ethernet or wifi based on how your pi is connected to the internet.
Choose Your Upstream DNS Provider
I chose cloud flare, you can choose whichever one you'd like.
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.
Choose Which Protocols You Wish to Block Over
I chose both.
Verify Your IP Address, Change It If You Wish
Install Admin Web Interface
This is a necessity, make sure it's checked to on before proceeding.
Install the Web Server
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
Logging queries just means recording the data of page requests, check it on if you want it on.
Package Configuration
It will configure some more packages, just go make yourself a coffee or something like that.
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.
You've Successfully Setup Pi-Hole
Make note of the IP address listed as well as the password at the bottom of the prompt.
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.
Logging In
Use the password from Step 16 to log in.
Logged In!!
Once logged in, click settings on the left side bar.
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.
On Your Device...
Go to settings or wherever you configure your internet connection. Go to your WiFi page.
On Your Device... Cont.
Click the info button, and then click Configure DNS
On Your Device... Cont.
Change DNS to manual, and add a new one.
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.
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!!