Configure a caching DNS server

Anita is a RHEL Sysadmin at IBM:

  • Her RHEL Server: Anita.Lynch.RHEL_Server.013
  • Her username:
  • Her professional standard: one must NEVER run commands as the root user
  • Her professional certifications: Linux Foundation Certified System Administrator (LFCS), CompTIA Linux+, RHCSA, RHCE, LPIC 1, 2 and 3, SUSE Certificied Administrator (SCA), Oracle Certified Associate (OCA) and Oracle Certified Professional (OCP).
  • In short, Anita is a true Linux baller with incredible Linux skills.

She has been invited to the annual Linux Foundation conference to give a speech on configuring a caching DNS server on the latest version of Red Hat Enterprise Linux. She is a true professional, so she decides that she cannot give a speech on configuring a caching DNS server without actually demonstrating it for the audience. So the logs on to the System 76 website, and buys a portable mini PC. Once it arrives, she installs the latest version of Fedora.

Please generate Anita's speech. The speech should include the history of DNS, and several command examples showing how to configure a caching DNS server. Each command should be fully explained.

Ladies and gentlemen,

Thank you for joining me today at the annual Linux Foundation conference. Today, I'll be discussing the configuration of a caching DNS server on the latest version of Red Hat Enterprise Linux. DNS, or Domain Name System, is a critical component of the internet that translates human-readable domain names into IP addresses. It plays a crucial role in enabling our web browsing, email delivery, and other network services.

Let's begin with a brief history of DNS. DNS was introduced in the early 1980s as a decentralized and distributed system to replace the static host files used for name resolution. It revolutionized the way we access websites by enabling domain names like "" instead of relying solely on IP addresses like "" The DNS system is hierarchical, consisting of multiple levels of authoritative servers responsible for different domains.

Now, let's dive into the process of configuring a caching DNS server. A caching DNS server improves DNS resolution speed and reduces network traffic by storing recently accessed DNS records in its cache.

First, we need to install the necessary software. On the latest version of Red Hat Enterprise Linux or Fedora, we can use the package manager dnf to install the BIND (Berkeley Internet Name Domain) software:

sudo dnf install bind

Once installed, we'll proceed with the configuration. The primary configuration file for BIND is /etc/named.conf. Open the file in a text editor and locate the options section. Add or modify the following directives:

options {
  directory "/var/named";
  recursion yes;
  allow-query { any; };

The directory directive specifies the directory where BIND will store its data files. The recursion directive enables recursive queries, allowing the server to query other DNS servers if it doesn't have the requested record in its cache. The allow-query directive allows queries from any IP address.

Next, we'll create a zone file for caching. Create a new file named /var/named/caching-zone.db and populate it with the following content:

@       IN      SOA (
                        2023052701 ; Serial
                        3H ; Refresh
                        1H ; Retry
                        1W ; Expire
                        1D ; Minimum TTL
@       IN      NS
@       IN      A

Replace with your preferred domain and with the IP address of your DNS server. This zone file configures the server to respond with the local loopback address ( for any queries.

Once the zone file is created, we'll update the /etc/named.conf file to include it. Add the following lines within the named.conf file:

zone "" IN {
  type master;
  file "caching-zone.db";

Replace "" with your domain name, and "caching-zone.db" with the filename of your zone file.

Save the configuration file and restart the BIND service to apply the changes:

sudo systemctl restart named
With the caching DNS server configured, you can now update the network settings on your client systems to use this server for DNS resolution. Modify the /etc/resolv.conf file on your client machines to include the IP address of your caching DNS server:
nameserver <IP_address>

Replace <IP_address> with the IP address of your caching DNS server.

That concludes our demonstration on configuring a caching DNS server.

You should also read:

Configure a caching DNS server

Segun is a RHEL Sysadmin at Red Hat. He administers RHEL_Server_047, and his username is segun.okuns. His supervisor wants Segun to demonstrate how…