Unbound is an optional recursive DNS resolver that lets Pi-hole resolve DNS queries directly from the root servers, eliminating reliance on upstream providers like Google (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/damianiglesias/pihole-ubuntu-deploy/llms.txt
Use this file to discover all available pages before exploring further.
8.8.8.8) or Cloudflare (1.1.1.1). When enabled, Pi-hole forwards all DNS queries to Unbound on 127.0.0.1#5335, which then walks the DNS hierarchy from the root down to the authoritative nameserver for each domain — no third-party involved.
Installation
During thedeploy.sh interactive setup you will be prompted at Step 4.5:
y and press Enter. The script will:
- Install the
unboundpackage viaapt. - Download the latest root hints file from internic.net to
/var/lib/unbound/root.hints. - Write the configuration file to
/etc/unbound/unbound.conf.d/pi-hole.conf. - Restart the
unboundservice.
Generated Configuration
The installer writes the following configuration to/etc/unbound/unbound.conf.d/pi-hole.conf:
Key Configuration Options
| Option | Value | Description |
|---|---|---|
verbosity | 0 | Silent logging. Increase to 1–5 for debug output. |
port | 5335 | Listens on a non-standard port to avoid conflict with Pi-hole on port 53. |
root-hints | /var/lib/unbound/root.hints | Path to the root nameserver list downloaded from internic.net. |
harden-glue | yes | Requires that glue records are within the authority of the zone. |
harden-dnssec-stripped | yes | Rejects unsigned DNSSEC answers where signing was expected. |
edns-buffer-size | 1232 | Safe buffer size (bytes) that avoids IP fragmentation on most networks. |
prefetch | yes | Pre-fetches popular cache entries before they expire, reducing latency. |
private-address | Multiple RFC-1918 ranges | Prevents DNS rebinding attacks by blocking private IPs in public DNS responses. |
Pointing Pi-hole at Unbound
After Unbound is installed, you must tell Pi-hole to use it as the upstream resolver.Log into the Pi-hole web interface
Navigate to
http://<server-ip>/admin in your browser and sign in with your admin password.Uncheck any existing upstream providers
Remove any checked upstream providers such as Google (
8.8.8.8) or Cloudflare (1.1.1.1). Leaving them enabled defeats the purpose of Unbound.Standalone Installation
If you skipped Unbound duringdeploy.sh and want to install it separately, run the following commands:
/etc/unbound/unbound.conf.d/pi-hole.conf and configure Pi-hole’s DNS settings to point to 127.0.0.1#5335 as described in the steps above.