Self-hosted DNS server: Pi-hole, AdGuard Home and Technitium
By Pull This RepoPosted 5 min read
Short answer
The easiest self-hosted DNS server is Pi-hole: install it on a Raspberry Pi or Linux box with one curl command, then set your router's DNS to its address and every device gets ad and tracker blocking. AdGuard Home does the same with encrypted DNS built in. Technitium is a fuller DNS server, and Unbound adds your own recursive resolver.
A self-hosted DNS server answers your network's "where is this website?" questions from a box you own, instead of from your internet provider. The popular reason to run one is network-wide ad blocking: when a device asks for an ad or tracker domain, the server refuses to answer, so the ad never loads, on phones, smart TVs and laptops alike, with nothing installed on them. This guide compares Pi-hole, AdGuard Home and Technitium DNS Server, adds Unbound as your own recursive resolver, and walks through setup, with facts read from each project's GitHub page and docs on 22 November 2026.
Which self-hosted DNS server should you use?
| Project | Best for | Runs on | Licence | Stars on 22 Nov 2026 | Latest release |
|---|---|---|---|---|---|
| Pi-hole | simple network-wide ad blocking | Linux (Raspberry Pi OS, Debian, Ubuntu, Fedora and more), or Docker | EUPL-1.2 | 62,175 | v6.6 (11 Nov 2026) |
| AdGuard Home | ad blocking with encrypted DNS and parental controls built in | Linux, macOS, Windows, FreeBSD, OpenBSD, Docker | GPL-3.0 | 38,726 | v1.0.0 (19 Nov 2026) |
| Technitium DNS Server | a full DNS server with zones, clustering and blocking | Windows, Linux, macOS, Raspberry Pi, Docker | GPL-3.0 | 10,426 | v15.6.2 (17 Oct 2026) |
| Unbound | your own recursive resolver behind one of the above | Linux and other Unix systems | BSD-3-Clause | 5,086 | 1.26.2 (21 Oct 2026) |
All four repos are active and none is archived. If you only want ads gone, start with Pi-hole or AdGuard Home. Choose Technitium if you also want to host your own DNS zones. Add Unbound to either if you would rather not forward lookups to a public resolver.
What do you need for a self-hosted DNS server?
Very little. Pi-hole's prerequisites page asks for 512 MB of RAM and at least 2 GB of free disk space, with 4 GB recommended, which is why an old Raspberry Pi is the classic home for it. Whatever you use needs:
- A fixed IP address. Devices find the DNS server by address, so it must not change. Pi-hole's docs say a DHCP reservation on your router is fine.
- Port 53 free. DNS uses TCP and UDP port 53. On Ubuntu, a built-in resolver service can already hold it, so check before you install.
- A machine that stays on. If the DNS server goes down, every device loses name lookups until it comes back.
How do you install Pi-hole?
Pi-hole's docs give a one-line installer:
curl -sSL https://install.pi-hole.net | bashThe project itself notes that piping to bash is controversial, because you do not see the code before it runs. Its docs offer a version you can read first:
wget -O basic-install.sh https://install.pi-hole.net
sudo bash basic-install.shThere is also an official Docker image, documented in the docker-pi-hole repo. The installer walks you through choosing an upstream DNS provider and blocklists. Pi-hole's web interface uses ports 80 and 443, falling back to 8080 and 8443 if another web server already has them.
How do you install AdGuard Home?
AdGuard Home is one program with its own web interface. Its README gives an automated install script for Linux, macOS, FreeBSD and OpenBSD, which it pipes straight into sh with the -v (verbose) flag. To read the script before it runs, download it first and pass the same flag:
curl -s -S -L -o install.sh https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh
sh install.sh -vThe same script takes -r to reinstall and -u to uninstall. On Windows, download the release from GitHub, and there is an official Docker image and a Snap package. On first start it listens on port 3000: open http://your-server-ip:3000 and complete the initial configuration wizard.
AdGuard's README includes a comparison table with Pi-hole. In it, AdGuard Home lists encrypted upstream DNS (DNS-over-HTTPS, DNS-over-TLS and DNSCrypt), running as a DNS-over-HTTPS or DNS-over-TLS server, parental controls, forced safe search and running without root as built in, where its table says Pi-hole needs extra software or blocklists. It is AdGuard's own table, so treat it as the vendor's view.
What makes Technitium DNS Server different?
Technitium is a complete DNS server that also blocks ads, rather than an ad blocker that happens to do DNS. Its README lists working as both an authoritative and a recursive server, primary, secondary and conditional forwarder zones, built-in clustering to manage several servers from one console, DNSSEC validation, and hosting your own DNS-over-TLS, DNS-over-HTTPS and DNS-over-QUIC services. Blocking uses one or more blocklist URLs.
It is a cross-platform .NET 10 app. Windows gets a setup installer, Linux and Raspberry Pi users follow the install post linked from the README, and Docker users start from the project's docker-compose.yml. That file maps the web console to port 5380:
curl -LO https://raw.githubusercontent.com/TechnitiumSoftware/DnsServer/master/docker-compose.yml
docker compose up -dThen open http://your-server-ip:5380. The compose file has an optional DNS_SERVER_ADMIN_PASSWORD setting for the console's admin password; edit it before you start. Need Docker first? See our guide to installing Docker on Ubuntu.
How do you add Unbound as a recursive resolver?
By default Pi-hole and AdGuard Home forward the lookups they allow to an upstream resolver, such as your provider or a public service. Unbound, from NLnet Labs, is a validating, recursive, caching resolver: it looks names up itself, starting from the root servers. Pi-hole's guide says that when you run your own resolver, no server can fully log the exact paths you are going.
The Pi-hole unbound guide, on a Debian-based system:
- Install it with
sudo apt install unbound. - Create the guide's config file, which makes Unbound listen only on
127.0.0.1port5335. - Restart Unbound and test it with
dig pi-hole.net @127.0.0.1 -p 5335. - Check DNSSEC:
dig fail01.dnssec.works @127.0.0.1 -p 5335should return SERVFAIL, anddig +ad dnssec.works @127.0.0.1 -p 5335should return NOERROR with theadflag. - In Pi-hole, go to Settings, then DNS, enter
127.0.0.1#5335under Custom DNS servers, untick every other upstream, and save.
How do you set your router's DNS to the new server?
This is what turns one server into protection for the whole house.
- Open your router's admin page and find the DHCP or LAN settings.
- Set the primary DNS server to your Pi-hole, AdGuard Home or Technitium address.
- Save, then reconnect a device, or wait for its lease to renew, and check it is using the new server.
Pi-hole's docs recommend exactly this: configure the router so DHCP clients use Pi-hole as their DNS server. If your router will not let you change DNS, both Pi-hole and AdGuard Home can act as the DHCP server instead; switch off the router's DHCP first. As a last resort, set DNS by hand on each device.
Avoid putting a public resolver in the secondary DNS slot. Devices may use it whenever they like, and those lookups skip your blocking.
What is the catch?
- One box, one point of failure. If it stops, name lookups stop for everyone. Some people run two DNS servers for that reason.
- Some sites break. Blocklists occasionally catch something you need. Expect to allowlist a domain now and then.
- Not every ad is a separate domain. Ads served from the same domain as the content, as on some video sites, get through DNS blocking.
- Devices can bypass it. Apps with hard-coded DNS servers or their own encrypted DNS skip your server.
- Do not expose port 53 to the internet. An open resolver can be abused. Use it on your own network or over a VPN.
For other apps that fit on the same small server, read our guide to what self-hosted means, and to keep your passwords on it as well, see our self-hosted password manager roundup.
Pull it. Stash it.
Questions people ask
What is a self-hosted DNS server?
It is a DNS server you run on your own network instead of using your internet provider's or a public one. Your devices ask it to look up domain names, so it can block ad, tracker and malware domains for every device at once, and keep a log of lookups that only you can see.
Is Pi-hole free and open source?
Yes. Pi-hole is free and its core is licensed under the European Union Public Licence, EUPL 1.2. It had 62,175 GitHub stars on 22 November 2026 and its latest release was v6.6, published 11 November 2026.
Pi-hole or AdGuard Home: which is better?
Both block ads by DNS and both are free. Pi-hole runs on Linux or in Docker. AdGuard Home is a single program for Linux, macOS, Windows and FreeBSD, with encrypted upstream DNS, parental controls and safe search built in. Pick AdGuard Home if you want those without extra software.
How do I make every device use my self-hosted DNS?
Give the DNS server a fixed IP address, then enter that address as the DNS server in your router's DHCP settings. New connections pick it up automatically. If your router cannot change DNS, Pi-hole and AdGuard Home both have a built-in DHCP server; turn off the router's DHCP first.
Do I need Unbound with Pi-hole?
No, it is optional. Unbound makes your server resolve names itself, starting from the root servers, instead of forwarding every lookup to a public resolver such as your provider's. Pi-hole's own guide sets it up on port 5335 and points Pi-hole at 127.0.0.1#5335.
Sources
- 1pi-hole/pi-hole
- 2Pi-hole docs: Prerequisites (read 2026-11-22)
- 3Pi-hole docs: Basic install (read 2026-11-22)
- 4Pi-hole docs: Post-install (read 2026-11-22)
- 5Pi-hole docs: unbound guide (read 2026-11-22)
- 6AdguardTeam/AdGuardHome
- 7AdGuard Home wiki: Getting Started (read 2026-11-22)
- 8TechnitiumSoftware/DnsServer
- 9NLnetLabs/unbound
More repos like this

omlahore/RemoveMacAI
RemoveMacAI: turn off Apple Intelligence and reclaim its storage on your Mac
Get tomorrow's repo in your feed
One free, open source repo a day as a short video, shown working, with the catch named. Pull it. Stash it.
