How to configure cache-only nameserver on CentOS / RHEL 7?

Caching-only nameservers, or recursive nameservers, offer resolution services but they are not authoritative for any zone. These DNS cache nameservers store answers to previous queries in the cache (memory) for a fixed period of time. When a caching-only nameserver receives a query, it answers from the cache if it can. If it does not have the answer in the cache, it forwards the query to an authoritative server.

 

Although it is not recommended for reasons of security, nameservers can also be configured to give authoritative answers to queries in some zones, while acting as a caching-only nameserver for all other zones.

 

Configuring cache-only nameserver

 

To configure a system as a DNS cache-only nameserver, perform the following steps (as the root user):

1. Install the bind package:

# yum install bind

 

2. Add the following line to the beginning of the /etc/resolv.conf file. This line indicates use of the local system as the primary nameserver:

# vi /etc/resolv.conf
nameserver 127.0.0.1

 

3. If NetworkManager is running, add the following line to the /etc/sysconfig/network-scripts/ifcfg-[interface] file:

DNS1=127.0.1.1

 

This step is only required if you are running NetworkManager on your system. You can also disable the NetworkManager on the system using the steps described in below post:

 

4. Ensure that the network service is running:

# systemctl start network

 

5. Enable and start the named service:

# systemctl enable named
# systemctl start named

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)