Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR4061: Setup a Pi-hole

Hosted by Kevie on 2024-02-26 00:00:00
Download or Listen

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



More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.