Sitemap

Say Goodbye to Ads & Hello to Control: Power Up Your Network with Raspberry Pi & AdGuard Home

10 min readJul 8, 2025
Press enter or click to view image in full size
Illustration of a Raspberry Pi board with text “AD” with a circle above it crossing the word out.

Hey there, Tech Explorer! Looking to gain control over privacy in your DNS queries and bring some filtering of ads or other undesired content right into your home network? Then I have the home project for you, just using a tiny but mighty Raspberry Pi! Today, we’re going to embark on an exciting journey to transform a Raspberry Pi 4 into your very own ad-blocking and privacy-enhancing DNS server using AdGuard Home. And don’t worry, we’ll walk through every step, keeping things super clear and straightforward.

Part 1: Getting Your Raspberry Pi Ready — The First Steps

Our adventure begins with preparing your Raspberry Pi 4. Think of this as laying the foundation for our awesome new network guardian!

1. Flashing Raspberry Pi OS onto an SD Card

First, you’ll need a microSD card (at least 16GB, a good quality one is recommended!) and a way to connect it to your computer.

1.1. Download Raspberry Pi Imager: Head over to the official Raspberry Pi website and download the Raspberry Pi Imager for your operating system. It’s a fantastic tool that makes this process a breeze.

1.2. Choose Your OS: Open Raspberry Pi Imager. Click “CHOOSE OS” and select “Raspberry Pi OS (64-bit)” under “Raspberry Pi OS (other).” We’re picking the desktop version because you’ll be managing your Pi primarily through its graphical interface.

1.3. Enable SSH and Set a Password (Crucial for Ease of Use!): This is a key step! Before you write the OS to the SD card, click on the gear icon (settings) in the Raspberry Pi Imager. Here, you’ll want to:

  • Enable SSH: Check the box. This allows you to remotely access your Pi if needed, though we’ll focus on the GUI.
  • Set username and password: Create a strong, memorable password for the default user (usually `pi`). Do NOT skip this!

1.4. Choose Storage: Click “CHOOSE STORAGE” and select your microSD card. Double-check that you’re selecting the correct drive, as this process will erase all data on it!

1.5. Write: Click “WRITE” and wait for the process to complete. This might take a little while. Once it’s done, safely eject the SD card.

2. Booting Up Your Raspberry Pi

Now for the exciting part!

2.1. Insert the prepared microSD card into the microSD card slot on your Raspberry Pi 4.

2.2. Connect a monitor to one of the HDMI ports, a keyboard, and a mouse to your Pi.

2.3. Connect the power supply to your Raspberry Pi. It should boot up, and you’ll see the Raspberry Pi OS desktop appear after a few moments.

Part 2: Giving Your Pi a Permanent Home — Setting a Static IP

By default, your Raspberry Pi will get an IP address automatically from your router (this is called DHCP). However, for a DNS server, we want it to have a consistent, unchanging address. This is like giving your Pi a permanent house number on your network!

We’ll aim to set your Raspberry Pi’s IP address to `192.168.1.2`, assuming your router is at `192.168.1.1`.

1. Open Network Settings: On the Raspberry Pi desktop, click on the network icon in the top right corner (it looks like two overlapping squares).

2. Wireless & Wired Network Settings: Select “Wireless & Wired Network Settings.”

3. Configure Interface: In the new window, under the “Interface” dropdown, select the network adapter you are using. Since we’re not setting up Wi-Fi, it will likely be `eth0` (for Ethernet).

4. IPv4 Tab: Make sure you’re on the “IPv4” tab.

5. Method: Change the “Method” dropdown from “Automatic (DHCP)” to “Manual.”

6. Enter IP Details:

  • IP Address: Enter `192.168.1.2`
  • Router: Enter `192.168.1.1` (This is your home router’s IP address)
  • DNS Servers: You can temporarily put `192.168.1.1` here, or you can use public DNS servers like `8.8.8.8` (Google) and `1.1.1.1` (Cloudflare). We’ll be replacing this with AdGuard Home later.
  • Optional — Static Routes: Leave this blank.

7. Apply: Click “Apply” and then “Close.”

8. Reboot: It’s a good idea to reboot your Raspberry Pi for the changes to take full effect. Click the Raspberry Pi icon in the top left, then “Shutdown,” and then “Reboot.”

After rebooting, your Raspberry Pi should now consistently have the IP address `192.168.1.2`.

Part 3: Getting Your Pi Up-to-Date and Installing AdGuard Home

Before we install AdGuard Home, let’s make sure your Raspberry Pi has all the latest software updates. This is like giving it a fresh set of clothes and tools!

1. Updating Your Raspberry Pi

1.1. Open Terminal: On the Raspberry Pi desktop, click on the terminal icon in the top bar (it looks like a black screen with `>_`).

1.2. Update Package Lists: Type the following command and press Enter:

sudo apt update

This command downloads the latest information about available software packages. You might be prompted for your password — this is the one you set during the flashing process.

1.3. Upgrade Installed Packages: Once that’s done, type this command and press Enter:

sudo apt upgrade -y

This command upgrades all the installed software to their latest versions. The `-y` flag tells it to automatically say “yes” to any prompts, so it runs smoothly. This process can take some time, depending on how many updates are available.

2. Installing AdGuard Home

Now for the main event! AdGuard Home is super easy to install.

2.1. Download AdGuard Home: In the same terminal window, type the following command and press Enter:

curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v

This command downloads and runs the official AdGuard Home installation script. It will automatically detect your system and install AdGuard Home. You’ll see some output as it works its magic.

2.2. Starting AdGuard Home: AdGuard Home should start automatically after installation. You can verify its status by running:

sudo systemctl status adguardhome

3. Controlling the AdGuard Home Service:

AdGuard Home runs as a service on your Raspberry Pi. This means it can run in the background and even start automatically when your Pi boots up. Here are some useful commands for managing the AdGuard Home service:

To start AdGuard Home:

sudo systemctl start adguardhome

To stop AdGuard Home:

sudo systemctl stop adguardhome

To restart AdGuard Home:

sudo systemctl restart adguardhome

To check the status of AdGuard Home:

sudo systemctl status adguardhome

Ensuring AdGuard Home Starts Automatically:
The installation script usually sets AdGuard Home to start automatically at boot. To confirm or enable this, use the following command:

sudo systemctl enable adguardhome

This command ensures that AdGuard Home will launch every time your Raspberry Pi starts up, so your ad-blocking DNS is always active.

Part 4: Configuring AdGuard Home — Your Personal Control Panel

AdGuard Home has a fantastic web interface that makes configuration a breeze.

1. Access the Web Interface: Open the web browser on your Raspberry Pi (or any computer on the same network) and go to:

http://192.168.1.2:3000

This will take you to the AdGuard Home setup page.

2. Initial Setup:

  • Welcome Screen: Click “Get Started.”
  • Web Interface Port: Leave this as `3000` unless you have a specific reason to change it.
  • DNS Server Port: Leave this as `53` (the standard DNS port).
  • Next: Click “Next.”
  • Admin User and Password: Create a strong username and password for your AdGuard Home administration. This is crucial for securing your settings. Write it down in a safe place!
  • Next: Click “Next.”
  • Installation Complete: Click “Open Dashboard.”

3. Log In: Enter the username and password you just created.

4. Setting Up Upstream DNS Servers with DNSSEC:

Now, let’s tell AdGuard Home which powerful, privacy-focused DNS servers to use for resolving your requests. We’ll also enable DNSSEC for extra security.

4.1. On the AdGuard Home dashboard, navigate to Settings > DNS settings.

4.2. Under Upstream DNS servers, you’ll see a box where you can add servers. Delete any default entries that might be there. We’ll add the following, one per line:

https://dns.google/dns-query
https://dns.cloudflare.com/dns-query
https://dns.quad9.net/dns-query

4.3. Under Bootstrap DNS servers, you can use common public DNS servers that help AdGuard Home resolve the addresses of your upstream servers. You can use:

8.8.8.8
1.1.1.1
9.9.9.9

4.4. Enable DNSSEC: Make sure the “Enable DNSSEC” checkbox is ticked. This is vital for verifying the authenticity of DNS responses.

4.5. Test Upstreams: Click the “Test Upstreams” button to ensure AdGuard Home can reach these servers. You should see green checkmarks next to them.

4.6. Apply: Click the “Apply” button at the bottom of the page to save your changes.

5. Boosting Your Blocking Power: Subscribing to Filter Lists

AdGuard Home gets its ad-blocking superpowers from filter lists. These are essentially long lists of domains known to serve ads, trackers, and malicious content. By subscribing to them, you instruct AdGuard Home to block anything on these lists.

5.1. From the AdGuard Home dashboard, go to Filters > DNS blocklists.

5.2. You’ll see an “Add a new list” button. Click it and then select ”Add a custom list.”

5.3. For each of the following lists, you’ll enter the “Name” (e.g., “AdGuard DNS filter”) and the “URL” for the list, then click “Add.”

  • AdGuard DNS filter - https://adguardteam.github.io/HostlistsForAdGuard/adguard-dns.txt
  • AdAway Default Blocklist - https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt
  • 1Hosts (Lite) - https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts
  • AdGuard DNS Popup Hosts filter - https://adguardteam.github.io/HostlistsForAdGuard/adguard-popup.txt
  • AWAvenue Ads Rule - https://raw.githubusercontent.com/FadeMind/unblock-us/master/system/etc/hosts
  • HaGeZi’s Pro Blocklist - https://raw.githubusercontent.com/hagezi/mirror-hagezi-dns-blocklists/main/pro.txt
  • OISD Blocklist Big - https://raw.githubusercontent.com/sjhgvr/oisd-blocklist/main/full.txt
  • Dan Pollock’s List - https://someonewhocares.org/hosts/hosts
  • Peter Lowe’s Blocklist - https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
  • Steven Black’s List - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

After adding each list, AdGuard Home will automatically update them. This might take a few moments.

A Word of Caution on Filter Lists:

Adding many filter lists can significantly improve ad blocking, but occasionally, a very aggressive list might accidentally block parts of legitimate websites you want to access. It’s highly recommended to keep an eye on AdGuard Home’s “Query Log” (accessible from the dashboard) for any blocked pages that shouldn’t be. If you encounter issues, you can temporarily disable lists or add specific domains to your “Allowlist.” The best strategy when experimenting with new lists is often to enable them one by one and monitor your Browse for any issues. However, the combination of lists provided (AdGuard DNS filter, AdAway Default Blocklist, 1Hosts (Lite), AdGuard DNS Popup Hosts filter, AWAvenue Ads Rule, HaGeZi’s Pro Blocklist, OISD Blocklist Big, Dan Pollock’s List, Peter Lowe’s Blocklist, Steven Black’s List) are generally known to work well together for a comprehensive ad-blocking experience with minimal conflicts for general usage.

6. Blocking Services

Beyond just ads and trackers, AdGuard Home can also block entire services, which can be useful for parental controls or simply reducing distractions.

6.1. From the AdGuard Home dashboard, navigate to Filters > Block services.

6.2. Here, you’ll see a wide array of popular services categorized (e.g., Social networks, Messengers, Video streaming).

6.3. Simply toggle the switch next to any service you wish to block. For example, if you want to block TikTok on your network, find “TikTok” and flip its switch to the “on” position.

6.4. Click “Save” at the bottom right after making your selections.

Blocking services here will prevent access to them for any device using your AdGuard Home DNS server. This is a powerful feature, so use it thoughtfully!

Congratulations! Your AdGuard Home is now set up to use secure, private DNS servers with DNSSEC and has a robust set of ad-blocking and service-blocking filters enabled!

Part 5: Directing Your Devices to AdGuard Home

The final step is to tell your home network devices to use your new Raspberry Pi DNS server. The easiest way to do this for all your devices is to configure your home router’s DHCP settings.

Important Note for the Novice: Every router’s interface is different. The following are general instructions. You’ll need to consult your router’s manual or look for its specific settings. Common sections to look for are “LAN Settings,” “DHCP Server,” or “Network Settings.”

1. Access Your Router’s Admin Page: Open a web browser on your computer and type your router’s IP address (likely `192.168.1.1`) into the address bar and press Enter. You’ll then need to log in with your router’s administration username and password (this is usually printed on a sticker on your router, or you set it up when you first got your router).

2. Find DHCP Settings: Look for a section related to “LAN Settings,” “DHCP Server,” or “Network Settings.”

3. Change Primary DNS Server: In the DHCP settings, you’ll find fields for “Primary DNS Server” and “Secondary DNS Server” (or similar).

  • Set the Primary DNS Server to your Raspberry Pi’s IP address: `192.168.1.2`.
  • For the Secondary DNS Server, you can either leave it blank, or, as a fallback, you could use `192.168.1.1` (your router), or another public DNS server like `8.8.8.8`. However, for full AdGuard Home benefits, it’s best to rely solely on your Pi.

4. Save Changes: Be sure to click “Apply,” “Save,” or “OK” to save your router’s new settings.

Crucial Warning About DHCP Leases:

Your devices (computer, phone, tablet, smart TV, etc.) “lease” IP addresses and DNS server information from your router for a certain period. When you change the DNS settings on your router, existing devices on your network will continue to use their old DNS settings until their current lease expires or they renew their lease.

To immediately switch devices to your AdGuard Home DNS:

  • Reboot the device: The simplest way is to reboot each device you want to use AdGuard Home. This will force them to request new DHCP information from your router, which will now include your Raspberry Pi’s IP address as the DNS server.
  • Release and Renew IP: On some devices (like Windows computers), you can manually release and renew your IP address from the command prompt (using `ipconfig /release` then `ipconfig /renew`).

Once your devices start using the Raspberry Pi as their DNS server, you’ll begin to notice fewer ads, and your online privacy will be enhanced thanks to DNSSEC! You can monitor the AdGuard Home dashboard on your Raspberry Pi (or from any browser at `http://192.168.1.2:3000`) to see the blocked ads and DNS queries in real-time.

Enjoy your cleaner, more secure internet experience, powered by your very own Raspberry Pi!

--

--

Antonio Checa
Antonio Checa

Written by Antonio Checa

Antonio is a result-oriented program manager with over 20 years of experience. He has a proven track record of successfully delivering a wide range of projects.

No responses yet