Questo contenuto non è disponibile nella lingua selezionata.
Chapter 2. Setting up an unbound DNS server
The unbound
DNS server is a validating, recursive, and caching DNS resolver. Additionally, unbound
focuses on security and has, for example, Domain Name System Security Extensions (DNSSEC) enabled by default.
2.1. Configuring Unbound as a caching DNS server Copia collegamentoCollegamento copiato negli appunti!
By default, the unbound
DNS service resolves and caches successful and failed lookups. The service then answers requests to the same records from its cache.
Procedure
Install the
unbound
package:dnf install unbound
# dnf install unbound
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
/etc/unbound/unbound.conf
file, and make the following changes in theserver
clause:Add
interface
parameters to configure on which IP addresses theunbound
service 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::1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow With these settings,
unbound
only 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-control
parameters 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 allow
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create private keys and certificates for remotely managing the
unbound
service:systemctl restart unbound-keygen
# systemctl restart unbound-keygen
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you skip this step, verifying the configuration in the next step will report the missing files. However, the
unbound
service automatically creates the files if they are missing.Verify the configuration file:
unbound-checkconf
# unbound-checkconf unbound-checkconf: no errors in /etc/unbound/unbound.conf
Copy 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 --reload
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable and start the
unbound
service:systemctl enable --now unbound
# systemctl enable --now unbound
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Query the
unbound
DNS server listening on thelocalhost
interface to resolve a domain:Copy to Clipboard Copied! Toggle word wrap Toggle overflow After querying a record for the first time,
unbound
adds the entry to its cache.Repeat the previous query:
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.