Este contenido no está disponible en el idioma seleccionado.
Chapter 3. Setting up an unbound DNS server
To validate, resolve, and cache DNS queries, configure the unbound DNS service. Additionally, unbound enhances security and has Domain Name System Security Extensions (DNSSEC) enabled by default.
3.1. Configuring Unbound as a caching DNS server Copiar enlaceEnlace copiado en el portapapeles!
To resolve and cache successful and failed lookup, and answer requests to the same records from its cache, configure the unbound DNS service.
Prerequisites
- You have administrative privileges.
Procedure
Install the
unboundpackage:dnf install unbound
# dnf install unboundCopy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
/etc/unbound/unbound.conffile, and make the following changes in theserverclause:Add
interfaceparameters to configure on which IP addresses theunboundservice listens for queries, for example:interface: 127.0.0.1 interface: 192.0.2.1 interface: 2001:db8:1::1
interface: 127.0.0.1 interface: 192.0.2.1 interface: 2001:db8:1::1Copy to Clipboard Copied! Toggle word wrap Toggle overflow With these settings,
unboundonly listens on the specified IPv4 and IPv6 addresses.Limiting the interfaces to the required ones prevents clients from unauthorized networks, such as the internet, from sending queries to this DNS server.
Add
access-controlparameters to configure from which subnets clients can query the DNS service, for example:access-control: 127.0.0.0/8 allow access-control: 192.0.2.0/24 allow access-control: 2001:db8:1::/64 allow
access-control: 127.0.0.0/8 allow access-control: 192.0.2.0/24 allow access-control: 2001:db8:1::/64 allowCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create private keys and certificates for remotely managing the
unboundservice:systemctl restart unbound-keygen
# systemctl restart unbound-keygenCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf you skip this step, verifying the configuration in the next step will report the missing files. However, the
unboundservice automatically creates the files if they are missing.Verify the configuration file:
unbound-checkconf
# unbound-checkconfCopy to Clipboard Copied! Toggle word wrap Toggle overflow unbound-checkconf: no errors in /etc/unbound/unbound.conf
unbound-checkconf: no errors in /etc/unbound/unbound.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow Update the firewalld rules to allow incoming DNS traffic:
firewall-cmd --permanent --add-service=dns firewall-cmd --reload
# firewall-cmd --permanent --add-service=dns # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enable and start the
unboundservice:systemctl enable --now unbound
# systemctl enable --now unboundCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Query the
unboundDNS server listening on thelocalhostinterface to resolve a domain:dig @localhost www.example.com
# dig @localhost www.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow ... __www.example.com.__ __86400__ IN A __198.51.100.34__ ;; Query time: __330 msec__ ...
... __www.example.com.__ __86400__ IN A __198.51.100.34__ ;; Query time: __330 msec__ ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow After querying a record for the first time,
unboundadds the entry to its cache.Repeat the last query:
dig @localhost www.example.com
# dig @localhost www.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow ... __www.example.com.__ __85332__ IN A __198.51.100.34__ ;; Query time: __1 msec__ ...
... __www.example.com.__ __85332__ IN A __198.51.100.34__ ;; Query time: __1 msec__ ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow Because of the cached entry, further requests for the same record are significantly faster until the entry expires.
For details, see
unbound.conf(5)man page on your system.