🎬

Video tutorial coming soon.

⚫ Setup Pi-hole — DNS Ad Blocker

Deploy Pi-hole as a network-level advertisement and internet tracker blocking application. Acts as a DNS sinkhole and optionally a DHCP server for your entire network.

⚠️ This script is provided for demo and testing purposes only.

📦 Resources & Setup Scripts

Grab the automated bash script from GitHub to follow along.

Automated install script — Pi-hole DNS server up in one command.
View on GitHub

Quick Install:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/networking/pihole/pihole-ubuntu.sh
chmod +x pihole-ubuntu.sh
sudo bash pihole-ubuntu.sh

Tutorial Steps

1 Download & Run the Script

The script installs Docker, pulls the Pi-hole image, and starts the container. A random admin password is generated and displayed at the end.

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/networking/pihole/pihole-ubuntu.sh
chmod +x pihole-ubuntu.sh
sudo bash pihole-ubuntu.sh

2 Access the Admin Dashboard

Open your browser and navigate to the Pi-hole admin panel:

http://YOUR-SERVER-IP/admin

3 Add Blocklists

Go to Group Management → Adlists to add blocklists. After adding, go to Tools → Update Gravity to download and apply the new block rules.

4 Configure Your Router DNS

Set your router's primary DNS server to your server's IP so all devices on the network benefit from ad blocking automatically. View query logs in the dashboard.

Ports Used

PortProtocolPurpose
53TCP/UDPDNS Queries
80TCPAdmin Web UI

Files Location

/root/docker/pihole/docker-compose.yml