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 to configure RHEL_Server_047 as a caching DNS server. He wants Segun to demonstrate all of the commands needed to setup a caching DNS server for a new class of 10 Red Hat interns so that they can competently complete the task when their 6 week RHEL Sysadmin class starts in 2 weeks. What will Segun demonstrate for the interns? Assume that Segun is highly skilled: he never makes rookie mistakes like running commands as root.

To configure RHEL_Server_047 as a caching DNS server, Segun can follow these steps and demonstrate them to the interns:

  1. Update the system:

    • sudo yum update
  2. Install the necessary packages:
    • sudo yum install bind bind-utils
  3. Configure the caching DNS server:

    • Open the main configuration file for BIND:
      • sudo vi /etc/named.conf
    • Modify the "options" section to include the following:
      • listen-on port 53 { any; };
        allow-query { any; };
        recursion yes;
  4. Configure the named caching configuration file:
    • Open the caching configuration file:
      • sudo vi /etc/named.rfc1912.zones
    • Add the following lines at the end of the file:
      • zone "." IN {
            type hint;
            file "named.ca";
        };

        zone "localhost.localdomain" IN {
            type master;
            file "named.localhost";
            allow-update { none; };
        };

        zone "0.0.127.in-addr.arpa" IN {
            type master;
            file "named.loopback";
            allow-update { none; };
        };

        zone "example.com" IN {
            type forward;
            forwarders { 8.8.8.8; };
        };
  5. Create the caching zone file:
    • sudo cp /var/named/named.empty /var/named/named.ca
  6. Start and enable the named service:
    • sudo systemctl start named
      sudo systemctl enable named
  7. Configure the firewall to allow DNS traffic:
    • sudo firewall-cmd --add-service=dns --permanent
      sudo firewall-cmd --reload
  8. Test the caching DNS server:

    • Use the dig command to test DNS resolution:
      • dig google.com
      • This should return the IP address of google.com, indicating that the caching DNS server is working correctly.

Segun should demonstrate each step and explain its purpose to the interns. They can then practice these steps and become competent in setting up a caching DNS server on their own.

 

You should also read: