RHEL7: Configure a caching-only name server.

Share this link

Note: This is an RHCE 7 exam objective.

Presentation of Caching-only Name Server

A cache-only name server keeps a cache of all the results of the previous requests to the root DNS servers.

Configuration Procedure

Install the bind package:

# yum install -y bind

Edit the /etc/named.conf file and change the listen-on option from to any:

listen-on port 53 { any; };

In the same file, change the allow-query option from localhost to any:

allow-query { any; };

In the same file, disable the dnssec-validation option:

dnssec-validation no;

Check the configuration file:

# named-checkconf

Add a new service to the firewall:

# firewall-cmd --permanent --add-service=dns

Reload the firewall configuration:

# firewall-cmd --reload

Activate the DNS service:

# systemctl enable named

Start the DNS service:

# systemctl start named

Time to Test

Check the configuration:

# nslookup cnn.com
# dig @ cnn.com

Additional Resources

You can also read this nice article from Zytrax.com about the different DNS Configuration Types.
If you want to go any further, check the master DNS server tutorial.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Leave a Reply

9 Comments on "RHEL7: Configure a caching-only name server."

Notify of
Sort by:   newest | oldest

In one of the tutorials I have seen they are installing unbound instead of bind, do you thing from the RHCE perspective it will matter to install bind or unbound?


What if I put my interface ip address in listen-on port directive and add my network ip in allow-query directive during the exam even if not asked in the question?
Because ‘any’ means no restriction.


why set dnssec-validation to no?


Hi Guys,
I haven’t seen any DNS question on RHCE mock test. Do you think that might be included in the exam ?

Thank you


It might be as it’s a part of RHCE exam objectives.

I’ve put a sample RHCE example exam here: https://www.lisenet.com/2016/rhce-sample-exam-for-rhel-7/ feel free to give it a try.


Hi everyone, when I configure a cache only dns server it doesn’t resolve any domain, but it works correctly when I add forwarders any ideas? If I ping a domain from shell it works…
Thanks in advance


RHCSA7: Task of the day

Allowed time: 5 minutes.
Create a new user account called "bob" with password "redhat" and set expiration in one week.

RHCE7: Task of the day

Allowed time: 10 minutes.
Change the SSH process configuration to only listen on the 443 port.

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...