Skip to content

07 Pi‐Hole for Domain Blocking

Code al Dente edited this page Jun 20, 2024 · 1 revision

To ensure that the blocklist from the GitHub repository is always up-to-date, you can add the list directly to Pi-Hole's adlists and configure it to update automatically. Here’s a step-by-step guide:

Step 1: Access Pi-Hole Admin Interface

  1. Open your web browser.
  2. Navigate to the Pi-Hole admin interface. This is usually at http://pi.hole/admin or http://<IP_ADDRESS>/admin, where <IP_ADDRESS> is the IP address of your Pi-Hole server.
  3. Log in with your admin password.

Step 2: Add the Blocklist URL to Pi-Hole

  1. Visit the GitHub repository to locate the blocklist URL.
  2. Copy the raw URL of the block.txt file. It should look something like this:
    https://raw.githubusercontent.com/Bon-Appetit/porn-domains/master/block.txt
    
  3. In the Pi-Hole admin interface, go to Group Management > Adlists.
  4. Click on the Add a new adlist field and paste the copied URL.
  5. Optionally, add a description for easy identification, such as "Porn Domains Blocklist."
  6. Click Add to save the new adlist.

Step 3: Update Pi-Hole

  1. In the Pi-Hole admin interface, go to Tools > Update Gravity.
  2. Click Update to apply the new adlist immediately.

Step 4: Automate Blocklist Updates

  1. Pi-Hole automatically updates its gravity list once a week by default. To ensure more frequent updates, you can adjust the cron job settings.
  2. Access the Pi-Hole server via SSH. Use a terminal or SSH client to connect to your Pi-Hole server:
    ssh pi@<IP_ADDRESS>
    Replace <IP_ADDRESS> with the IP address of your Pi-Hole server.
  3. Edit the cron job settings:
    sudo nano /etc/cron.d/pihole
  4. Modify the update frequency as needed. For example, to update daily at midnight, you can add:
    0 0 * * * root PATH="$PATH:/usr/local/bin/" pihole updateGravity > /dev/null
  5. Save the changes and exit the editor (Ctrl + X, then Y, and Enter).

Step 5: Verify the Blocklist

  1. Return to the Pi-Hole admin interface.
  2. Go to Query Log.
  3. Check if the domains from the blocklist are being blocked as expected.

Step 6: Maintain the Blocklist

  • Regularly check the GitHub repository for any changes or updates to the blocklist URL.
  • Ensure your Pi-Hole server is running smoothly and the updates are applied as scheduled.

By following these steps, Pi-Hole will automatically update and use the blocklist from the GitHub repository, ensuring that your network is always protected from unwanted content.