Intro#
Unbound is a validating, recursive, and caching DNS resolver from NLnet Labs. It runs on FreeBSD, OpenBSD, NetBSD by default and is available for Linux, macOS, and Windows. Unbound is written in C and is open-sourced under the BSD license.
We assume you have a freshly installed Rocky Linux 9 with static IP addresses configured. We'll use 2001:db8::53 and 192.0.0.53 as examples.
Update and reboot the system:
dnf -y upgrade
reboot
Installation and configuration#
Install EL shipped unbound:
dnf install unbound
Allow the DNS service through firewalld:
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
Unbound configuration: the configuration file is rather overloaded which makes unbound highly customizable. To make it simple, let's override the initial file and only set the most important parts.
cp /etc/unbound/unbound.conf /etc/unbound/unbound.conf.og
> /etc/unbound/unbound.conf
vi /etc/unbound/unbound.conf
/etc/unbound/unbound.confserver:
num-threads: 4
interface: ::1
interface: 127.0.0.1
interface: 192.0.0.53
interface: 2001:db8::53
access-control: 127.0.0.1 allow
access-control: ::1 allow
# Adjust to your ipv6 network(s)
access-control: 2001:db8::/48 allow
# adjust to your ipv4 network(s)
access-control: 192.0.2.0/24 allow
access-control: 192.168.0.0/16 allow
chroot: ""
username: "unbound"
directory: "/etc/unbound"
pidfile: "/var/run/unbound/unbound.pid"
Finally enable and start Unbound DNS resolver server:
systemctl enable --now unbound
This configuration works for small deployments. For other scenarios, you may read all configuration options from the official Unbound documentation website.