Pi-hole Installation

Ad blocking and secure DNS - BTS SIO SISR

Objective

Deploy Pi-hole, a DNS server with network-level ad and tracker filtering. Protects all network devices without individual configuration.

Prerequisites

Full Procedure

Step 1: Static IP configuration (recommended)

nano /etc/network/interfaces

Example configuration:

auto eth0
iface eth0 inet static
 address 192.168.1.200
 netmask 255.255.255.0
 gateway 192.168.1.1
 dns-nameservers 1.1.1.1 8.8.8.8

Restart networking:

systemctl restart networking

Step 2: Automated Pi-hole installation

curl -sSL https://install.pi-hole.net | bash
Note: The installation script is interactive. Follow the steps below.

Step 3: Configuration during installation

Network interface selection

Upstream DNS provider selection

Blocklists

Protocols

Static IP address

Administration web interface

Query logs

Installation complete: Note the automatically generated admin password!

Step 4: Access the web interface

Access via browser:

http://192.168.1.200/admin

Log in with the password provided at the end of installation

Step 5: Change admin password

pihole -a -p

Enter the new password twice

Step 6: Configure network clients

Option A: Router DHCP configuration (recommended)

Change the router's primary DNS server to point to Pi-hole:

All network devices will automatically use Pi-hole

Option B: Manual configuration per workstation

Windows:

Linux:

nano /etc/resolv.conf

nameserver 192.168.1.200
nameserver 1.1.1.1

Verification

DNS resolution test

nslookup google.com 192.168.1.200

Should return Google's IP address

Blocking test

Test with a known advertising domain:

nslookup ads.google.com 192.168.1.200

Should return 0.0.0.0 or Pi-hole's IP (blocked domain)

Browser test

Access a site with ads → ads should be blocked

Check in the Pi-hole dashboard that queries appear

Advanced configuration

Adding extra blocklists

Web interface → Group Management → Adlists

Recommended lists:

https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://v.firebog.net/hosts/Easylist.txt
https://v.firebog.net/hosts/AdguardDNS.txt

Update the lists:

pihole -g

Whitelist (unblock a domain)

Web interface → Whitelist → Add

Or from the command line:

pihole -w example.com

Blacklist (block a specific domain)

pihole -b badsite.com

Enable Pi-hole DHCP server

Settings → DHCP → DHCP Server enabled

Useful commands

# Update Pi-hole
pihole -up

# Update blocklists
pihole -g

# Statistics
pihole -c

# Service status
pihole status

# Restart Pi-hole
pihole restartdns

# Real-time logs
pihole -t

# Flush DNS cache
pihole restartdns reload

Security and Limitations

Advantages

Limitations

Points to note:
  • SPOF (Single Point of Failure): if Pi-hole goes down, no DNS
  • Does not block YouTube ads (embedded in videos)
  • May break some sites (false positives) → use whitelist
  • Not an antivirus (blocks only via DNS)
  • Devices can bypass with manual DNS (8.8.8.8)

Recommendations

pihole -a -t

Key Points for the BTS Oral