🏠 Home DNS Server with Raspberry Pi

Walkthrough of my DNS Project

🎯 Project Overview & Hardware

This page is a walkthrough of my home DNS setup and installation

πŸ—οΈ Network Architecture

Internet ↔ Router ↔ Raspberry Pi DNS Server ↔ Home Devices

πŸ“± Phones β€’ πŸ’» Laptops β€’ πŸ“Ί Smart TVs β€’ 🏠 IoT Devices

Key Features

  • Network-wide Ad Blocking: Block ads and trackers across all devices
  • Custom DNS Records: Easy access to local services (e.g., server.local)
  • High Availability: Automatic failover to backup DNS servers
  • Detailed Analytics: Monitor DNS queries and blocked content
  • Low Power Consumption: Runs 24/7 on minimal electricity

Hardware

  • Raspberry Pi 5 8GB ram
  • 32gb MicroSD card
  • 1TB NVME SSD PCIe
  • Power supply (official Raspberry Pi power adapter)
  • Pironman 5 NVMe M.2 SSD PCIe Mini PC Case

πŸš€ Initial Raspberry Pi Setup

I followed the instructions from this helpful video, along with the manual, to assemble the PironMan 5 case. This project can be done with just a raspberry pi without the pironman case. I chose this case as it comes with adapter boards to increase functionality. Based on cost you could purchase a cheap micro desktop for the same cost. I chose to go with the pi for the learning experience.

Video by Wagner's Tech Talk. Watch the full video here.

πŸ“Pi-OS Installation & Configuration

1 Installed Pi-OS on Micro SD

Downloaded the installer from Raspberry Pi Software. You can purchase a Raspberry Pi with a preformatted card, but I recommend formatting it yourself to have more control, such as setting passwords and enabling SSH, among other configurations. After formatting the micro sd I inserted it into the pi and was able to boot sucessfully.

2 Downloaded Pi-hole

To install Pi-hole, I cloned the GitHub repository and followed the installation steps from the official documentation:

git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
			cd "Pi-hole/automated install/"
			sudo bash basic-install.sh

3 Connected Client PC to DNS

There are two methods to enable DNS. One involves configuring your router, which is the preferred method as it only requires setting up a single device. However, my ISP does not allow router-level DNS configuration, so I had to manually configure each client device to connect to the DNS server individually.

4 Set Up NVMe as Boot Drive

The previous steps are all that's necessary to set up a DNS server on a Raspberry Pi. My build includes a HAT to utilize an NVMe SSD, which increases both storage capacity and performance. I used the command line to partition the drive and install the operating system onto the SSD.

It’s recommended to keep the microSD card as the primary boot device. Once the OS is installed on the SSD, you can remove the microSD card to force the Pi to boot from the SSD. This approach provides a fallbackβ€”if any issues occur with the SSD, simply reinsert the microSD card to boot back into the original system.

Impact

This project allowed me to gain hands-on experience working with a Raspberry Pi and setting up a DNS server, while also providing continued opportunities to work with network security tools such as a firewall. Additionally, it helped me understand how to minimize the attack surface by implementing proper configurations and access controls.