Skip to content

viv-4/pi-vacy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi-hole + Unbound DNS Privacy Setup

A simple automated setup for running a private, ad-free, privacy defending DNS server on a Raspberry Pi 5.

What This Does

This project turns your Raspberry Pi into a private DNS server that:

  • Blocks ads and trackers at the network level (using Pi-hole)
  • Protects your privacy by running your own DNS resolver (using Unbound)
  • Works for all devices on your home network—phones, computers, tablets, etc.

Think of it like an ad blocker for your entire network, not just one device.

ISP DNS Private DNS

What You Need

  • Raspberry Pi 5 (running Raspberry Pi OS Lite 64-bit - 2GB RAM is sufficient)
  • Power supply for the Pi
  • Ethernet cable (recommended for reliability)
  • Way to access the Pi (keyboard + monitor, or SSH from another computer)

How to Install

Step 1: Prepare Your Raspberry Pi

  1. Download Raspberry Pi OS Lite (64-bit) from raspberrypi.com/software
  2. Write it to an SD card using the Raspberry Pi Imager
  3. Power on your Pi and connect it to your network
  4. Log in as the default user (usually pi)

Step 2: Download and Run the Setup Script

  1. On your Pi, download the setup script:
    cd /home/pi
    wget https://raw.githubusercontent.com/viv-4/pi-vacy/refs/heads/main/setup.sh
  2. Run the script:
    sudo ./setup.sh
  3. Wait for it to complete (5-10 minutes)

That's it! The script automatically:

  • Installs system & security updates
  • Installs Docker
  • Sets up Pi-hole (ad blocker)
  • Sets up Unbound (private DNS)
  • Starts everything running

Using Your New DNS Server

Option 1: Configure Your Router (Recommended)

  • Log into your home router settings
  • Find the DNS settings
  • Set the DNS server to your Pi's IP address (e.g., 192.168.1.100)
  • All devices on your network now use your private DNS

Option 2: Configure Individual Devices

  • Go to Settings → Network/WiFi
  • Find DNS settings
  • Enter your Pi's IP address as the DNS server

Access the Control Panel

Once running, you can manage everything through Pi-hole's web interface:

  1. Open a web browser
  2. Go to: http://<your-pi-ip>:8085/admin
  3. Log in with your password (output by setup script or found in .env file in same location)

From here you can:

  • View blocked ads/trackers
  • See which devices are using the DNS
  • Add custom blocklists
  • Configure whitelists/blacklists

Block Lists

By default a block list containing ad and malicious domains is installed.

You can add more lists from the Pi-hole admin interface.

eg. Various Lists can be found at: https://github.com/zachlagden/Pi-hole-Optimized-Blocklists

  • Recommend the all_domains.txt list for maximum blocking.
  • If this blocks too much use comprehensive.txt instead.
  • To block adult content add nsfw.txt as well.
  1. Copy the link of a list and add it under Lists -> Add a new subscribed list.
  • repeat for multiple lists
  1. Update Gravity to apply the new lists: Tools -> Update Gravity -> Update

Troubleshooting

Nothing is blocking ads?

  • Make sure your router is pointing to the Pi's DNS, or configure devices individually

Can't access the web interface?

  • Find your Pi's IP: On the Pi, run hostname -I
  • Make sure you're on the same network
  • Check that Docker containers are running: docker ps

Containers not running?

  • Check logs: docker logs pihole
  • Restart: docker compose restart

What Gets Installed

  • Docker - Container system (like lightweight virtual machines)
  • Pi-hole - Ad/tracker blocker
  • Unbound - Private DNS resolver
  • Autoheal - Keeps containers running if they crash

External Access

  • By default Unbound does not expose it's ports outside the Pi & PiHole is configured to only be exposed to the trusted local network.
  • If you want to access DNS or blocking from outside your local network, you will need to set up port forwarding on your router to PiHole.
    • This is not recommended as it exposes your DNS server to be used by others to perform malicious activities.
  • If you do need external access, consider adding a VPN to your Pi and only expose the VPN port through your router.
    • Be aware this adds an external security risk to your network, which is otherwise not exposed, if not configured properly or vulnerabilities are found in the VPN software.

More Information

About

Local, private DNS with blocking of Ads/Trackers/Malicious & Suspicious Sites for Raspberry Pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages