Skip to main content

Step-by-Step Guide to Setting Up Pi-hole: Your Personal Network Ad Blocker



Step-by-Step Guide to Setting Up Pi-hole: Your Personal Network Ad Blocker

exploring-boundless-creativity-of-generative-ai.jpg


Step 1: Installing Raspbian OS

Download the latest version of Raspbian from the Raspberry Pi website:


wget https://downloads.raspberrypi.org/raspios_lite_armhf_latest


Flash Raspbian onto the microSD card using Raspberry Pi Imager:


sudo raspi-config


Select "Write" and choose the downloaded Raspbian image.



Step 2: Initial Configuration

Boot up the Raspberry Pi with the Raspbian OS.


Configure basic settings:

sudo raspi-config


Set timezone, locale, and Wi-Fi (if applicable).


Update the system:

sudo apt-get update

sudo apt-get upgrade -y


Step 3: Installing Pi-hole

Download and install Pi-hole using the automated installer:



curl -sSL https://install.pi-hole.net 


Follow the on-screen instructions to complete the installation.


Step 4: Configuring Pi-hole

Choose a static IP address for the Raspberry Pi:



sudo nano /etc/dhcpcd.conf



Add the following lines at the end of the file, but be sure to replace it with your own static and ip address. :

interface eth0

static ip_address=192.168.1.2/24

static routers=192.168.1.1

static domain_name_servers=127.0.0.1

Restart the network interface:



sudo service networking restart

Access the Pi-hole web interface:



http://pi.hole/admin

Configure Pi-hole settings such as upstream DNS provider and blocklists through the web interface.


Step 5: Setting Up AdGuard DNS

Edit the DNS configuration file:


sudo nano /etc/dnsmasq.d/01-pihole.conf

Add the AdGuard DNS servers:

Adguard has build in adblocking servers by default, but it also offers one without it. there are services like Quad9 and 1.1.1.1 that offer DNS of which quard9 has its own malware filtering. You can also register to  Adguard private DNS services which allow you to log your DNS quires.



server= <choose from below>

server=<choose from below>


Default servers

AdGuard DNS will block ads and trackers.

94.140.14.14

94.140.15.15

Non-filtering servers

AdGuard DNS will not block ads, trackers, or any other DNS requests.

94.140.14.140

94.140.14.141

Family protection servers

AdGuard DNS will block ads, trackers, adult content, and enable Safe Search and Safe Mode, where possible.

94.140.14.15

94.140.15.16


Restart the Pi-hole DNS service:


sudo service dnsmasq restart

Test the AdGuard DNS configuration:


dig @176.103.130.130 example.com


Verify that AdGuard DNS is being used by checking the Pi-hole dashboard or using DNS leak test websites. or additionally you can use Adguards test service to verify the status of your DNS


Step 6: Finalizing Configuration

Monitor Pi-hole's performance and blocklist activity through the web interface.


Update Pi-hole to the latest version:



pihole -up

Backup Pi-hole configurations and settings:


pihole -a -t

Troubleshoot any common issues by referring to Pi-hole documentation or community forums.


Congratulations! You have successfully set up Pi-hole and configured AdGuard DNS for network-wide ad blocking and enhanced privacy.