Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at


hpr4061 :: Setup a Pi-hole

Setting an ad blocker and extra security using a Raspberry Pi with Pi-hole

<< First, < Previous, , Latest >>

Thumbnail of Kevie
Hosted by Kevie on 2024-02-26 is flagged as Clean and is released under a CC-BY-SA license.
security, adverts, filters, home network, router. 2.
The show is available on the Internet Archive at: https://archive.org/details/hpr4061

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:23:11

general.

Kevie, a co-host of TuxJam, talks about setting up a Raspberry Pi as a network wide ad and domain blocker using the Pi-hole project.

Before starting this project you will need:

  • A Raspberry Pi with Raspberry Pi OS installed and SSH enabled
  • A basic knowledge of changing the settings on your router. I can't talk you through this as every router is different. Specifically you need to know how to give a device a static IP address and set a DNS server
  • The ability to use SSH

Once we have SSH'd into the Pi the first thing we should do is update it:

sudo apt update && sudo apt upgrade -y

Then we need to install the Pi-hole software itself. We can do this with the command:

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

This will start an installation wizard

Once this has completed, it is recommended that you set a new admin password:

pihole -a -p

Exit the Pi and go to the admin web page by entering {the_IP_of_your_Pi}/admin in your browser's address bar.

Click on Adlist on the left side and you should see 2 input boxes. The address is where we can enter our adlist, the comment box is purely optional. Go to firebog.net/ Choose one or two from each category, but make sure that these are active (the ones in green).

Add the following two addresses to Adlist if you wish to block pornographic site:

  • https://raw.githubusercontent.com/Sinfonietta/hostfiles/master/pornography-hosts
  • https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts

For a list of specific types of sites to block then visit https://blocklistproject.github.io/Lists/

If using Cloudflare, you can add another pornography filter. Click on Settings on the left and then the DNS tab at the top. In Custom 1 (IPv4) enter the value 1.1.1.3, make sure that it is ticked.

If there is a specific site that you want to block then click on Domains in the menu on the left and add the domain. If you want to block it, then click Blacklist or if Pi-hole is blocking a site that you want to access then click on Whitelist.

Before we exit we must apply these changes or they will not take effect. On the left click on tools and then Update Gravity from the drop down menu. Press the Update button (it will take a couple of minutes to complete). You must do this every time that you make a change. Any time you add a new Adlist, Domain, Whitelist or Blacklist, it will not take effect until you do this.

Go to your Router's homepage, set the DNS server to the IP address of the Pi. This means that all traffic will run through the Pi-hole. Don't forget to hit apply if necessary before exiting.

One final task: reboot your router. This will force every device to reconnect and everything will be running through the Pi-hole.


Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2024-02-27 18:39:04 by Henrik Hemrin

Informative how and why setup a Pi-hole

This presentation was informative about Pi-hole. I have heard about it and may setup one myself one day. Now I have a good understanding of how to do it and its purpose.

Comment #2 posted on 2024-02-27 19:03:42 by norrist

Run pi-hole without a pi

I had put off using pi-hole because I didn't want to have an extra raspberry pi.

I was happy to learn that any debian installation is supported, so I set up pi-hole on a debian virtual machine.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?