Unbound container setup
Introduction
Pi-hole is a network-level ad blocker that acts as a DNS sinkhole, filtering out unwanted advertisements and tracking domains to enhance privacy and improve browsing speed. Using Unbound in combination with Pi-hole allows you to run a recursive DNS server, adding an extra layer of privacy by ensuring DNS queries are resolved locally without relying on third-party DNS providers.
Setup
-
Create the network
dns-net
You need to create a Docker network first, this will also allow Pi-hole to communicate with Unbound.
Run the following command:
-
Create the folders needed by the container
Run the following commands inside your home folder:
-
Download
root.hints
The
root.hints
file is not often changed but you can run the command below (or use the crontab) every 6 months to be sure. Run the following command: -
Create
unbound.conf
Save the following configuration as
unbound.conf
: -
Create the script needed to run the container
Save the following script as
unbound_run.sh
:Instructions:
- Optional Replace
docker
withpodman
if needed - Optional The setting
--ip=172.19.0.5
contains the fixed IP address of the container in the range of the dns-net network, you can change this if needed - Optional The settings
-p 5053:5053/tcp
and-p 5053:5053/udp
contains the ports used by Unbound. The port number is for example used by Pi-hole as part of the custom upstream DNS server. Do not forget to also change theinterface
in the configuration fileunbound.conf
- Optional Replace
-
Run the script to create the container
Run the following command:
The image
klutchell/unbound
is automatically pulled and the container is created. -
Check the results
If needed you can check if the container is running properly.
Run the following command to check if Unbound is working properly:
If you want to use Unbound with Pi-hole make sure Unbound is configured within Pi-hole as
Upstream DNS server
. There you can add the IP and port172.19.0.5#5053
asCustom 1 (IPv4)
.
No comments found for this note.
Join the discussion for this note on Github. Comments appear on this page instantly.