Configure a caching DNS server

Lycia is a RHEL Sysadmin at Google:

Her RHEL Server: Lycia_RHEL_Server_01

Her username: lycia.lycia

Her preference: Linux commands must NEVER be run as the root user

Her task: Configure a caching DNS server

Lycia has been the assigned the task of doing a step-by-step walkthrough of configuring a caching DNS server of RHEL. Please list and explain all of the steps that Lycia will perform.

To configure a caching DNS server on RHEL (Red Hat Enterprise Linux), Lycia can follow the steps below:

Step 1: Install the required packages

  • Open a terminal or SSH into the RHEL server as the non-root user (lycia.lycia).
  • Use the package manager (yum) to install the necessary packages:
  • $ sudo yum install bind bind-utils

Step 2: Configure the named.conf file

  • Open the named.conf file using a text editor (such as vi or nano):
  • $ nano /etc/named.conf
  • Modify the "options" section in the named.conf file according to the caching DNS server requirements. This may include settings such as listening on specific IP addresses, allowing recursion, defining forwarders, etc. Here's an example configuration:
  • options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory   "/var/named";
        dump-file   "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        recursion yes;
        allow-query { any; };

        forwarders {
            8.8.8.8;
            8.8.4.4;
        };
    };

Step 3: Create the caching configuration file

  • Create a new file called "named.conf.options" in the "/etc/named" directory:
  • $ sudo nano /etc/named/named.conf.options
  • Add the caching-related options in this file. For example:
  • options {
        directory "/var/named";
        recursion yes;
        allow-query { localhost; 192.168.0.0/24; };

        forwarders {
            8.8.8.8;
            8.8.4.4;
        };

        dnssec-enable no;
        dnssec-validation no;

        auth-nxdomain no;
        listen-on-v6 { any; };
    };

Step 4: Configure the firewall

  • If the RHEL server has a firewall enabled (such as firewalld), ensure that it allows incoming DNS requests. Run the following commands to open the required ports:
  • $ sudo firewall-cmd --permanent --add-service=dns
    $ sudo firewall-cmd --reload

Step 5: Start and enable the DNS service

  • Start the DNS service:
  • $ sudo systemctl start named
  • Enable the DNS service to start automatically on system boot:
  • $ sudo systemctl enable named

Step 6: Verify the DNS server

  • To verify that the caching DNS server is functioning correctly, use the "dig" command to query a domain name:
  • $ dig example.com
  • The response should contain the queried domain's information.

That's it! Lycia has now successfully configured a caching DNS server on her RHEL 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…