Master DNS Configuration Linux Step by Step

master DNS, Domain name system. DNS major role is to convert human readable domain names to machine known numbers (IP Address). World resource connected to the internet or a private network by decentralized naming system. Master DNS configuration Linux Step by Step Guide.

The Domain Name System delegates the responsibility of assigning domain names and mapping those names to Internet resources by designating authoritative name servers for each domain. Network administrators may delegate authority over sub-domains of their allocated name space to other name servers. This mechanism provides distributed and fault tolerant service and was designed to avoid a single large central database.

Based on working method types of DNS are there, few are mentioned below

  1. Primary / Master DNS
  2. Slave DNS
  3. Forwarding DNS
  4. Caching DNS
  5. Authoritative-Only DNS

Primary / master DNS and Slave DNS Servers

Given the importance of DNS in making services and entire networks accessible, most DNS servers that are authoritative for a zone will have built-in redundancy. There are various terms for the relationships between these servers, but generally, a server can either be a master or a slave in its configuration.

Both master and slave servers are authoritative for the zones they handle. The master does not have any more power over the zones than the slave. The only differentiating factor between a master and a slave server is where they read their zone files from.

A master server reads its zone files from files on the system’s disk. These are usually where the zone administrator adds, edits, or transfers the original zone files.

The slave server receives the zones that it is authoritative for through a zone transfer from one of the master servers for the zone. Once it has these zones, it places them in a cache. If it has to restart, it first checks its cache to see if the zones inside are up-to-date. If not, it requests the updated information from the master server.

Forwarding DNS Server

This approach adds an additional link in the chain of DNS resolution by implementing a forwarding server that simply passes all requests to another DNS server with recursive capabilities (such as a caching DNS server).

The advantage of this system is that it can give you the advantage of a locally accessible cache while not having to do the recursive work (which can result in additional network traffic and can take up substantial resources on high traffic servers). This can also lead to some interesting flexibility in splitting your private and public traffic by forwarding to different servers.

Caching DNS Server

A caching DNS server is a server that handles recursive requests from clients. Almost every DNS server that the operating system’s stub resolver will contact will be a caching DNS server.

Caching servers have the advantage of answering recursive requests from clients. While authoritative-only servers may be ideal for serving specific zone information, caching DNS servers are more broadly useful from a client’s perspective. They make the DNS system of the world accessible to rather dumb client interfaces.

Authoritative-Only DNS Server

An authoritative-only DNS server is a server that only concerns itself with answering the queries for the zones that it is responsible for. Since it does not help resolve queries for outside zones, it is generally very fast and can handle many requests efficiently.

A Few DNS Records Master DNS Server RHEL 7

A = Address record
PTR  = Pointer record
NS = Name service / server
MX = Mail Exchanger
SOA = State of Authority
CNAME =    Canonical name / Alias Name

Master DNS Server Profile

  • Packages Required   :  bind*
  • Version    :  9
  • Daemon  : named
  • Config File  : /var/named/chroot/etc/named.conf         /var/named/chroot/etc/
  • Default zone files location :         /var/named/chroot/var/named/
  • Port Number  : 53
# yum install bind* -y

First start named-chroot before named.service because it will generate config files

# systemctl start named-chroot.service
# systemctl start named.service
# vim /var/named/chroot/etc/named.conf

options {
        listen-on port 53 {;; };
        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";
        allow-query     { localhost;; };

(Default line number is 10-17) As shown above enter your DNS server IP address (which is your server address) and network address which network you want to provide DNS service.

Now edit zones configuration file

# vim /var/named/chroot/etc/named.rfc1912.zones

zone "" IN {
        type master;
        file "";
        allow-update { none; };

zone "" IN {
        type master;
        file "";
        allow-update { none; };

as shown above copy the zone configuration lines (Default line numbers from 19 to 23) and paste there itself. copy the Reverse zone configuration line  (Default line number 31 to 35) and paste there itself. Now modify the copied lines as per your requirement ( which are in pink color).

zone “” IN {  in this line whatever the domain name you would like to configure mention that

file “”;  file name whatever the file name you want you can give

zone “” IN { in this line write your IP address in reverse way

file “”; file name whatever the file name you would like.

Save configuration file and Exit

Creating Zone files

Forward lookup zone – forward lookup zone will convert host name name to IP address

Reverse lookup zone – reverse lookup zone will convert IP address to  host name

change directory path to /var/named/chroot/var/named/

copy the files as per the file names which we have mentioned in above zones configuration file

in this example

named.local –>

named.loopback –>

# cd /var/named/chroot/var/named
# cp named.localhost
# cp named.loopback
# vim 
@    IN SOA (
                    0    ; serial
                    1D    ; refresh
                    1H    ; retry
                    1W    ; expire
                    3H )    ; minimum
 ;DNS Server Name Records
@       IN      NS
@       IN      NS

  ;Name Servers Host name to IP
@       IN      A
@       IN      A

  ;Hosts in this domain records
@       IN      A
@       IN      A
techtutorial  IN      A
slave   IN      A

As shown in above configuration – DNS Server Name and domain name

add NS record as DNS Server name and domain name (do not forgot to add (dot) yet end)

First A record will be your domain name and DNS server IP address

[root@Techtutorial named]# vim 
@       IN SOA (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
  ;Name Servers
@       IN NS
@       IN NS
@       IN PTR
  ;Name Servers Hostname to IP Address
@       IN      A
@       IN      A
  ;Domain records
128      PTR
129      PTR

Note: Even do not miss single (dot) which will not start your named service

Master DNS configuration Linux Step by Step Guide

i have shown single host record as a example if you want to add more records add them

Now change the ownership of created files to named group

# chown root:named 
# chown root:named

Add firewall rule to communicate DNS port out

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

Now restart your named service.

# systemctl restart named.service 
# systemctl status named.service

Now go to client side and add DNS server IP to /etc/resolve.conf

[root@Techtutorial named]# vim /etc/resolve.conf

verify master dns server

# nslookup
#dig -x

That’s about installing and configuring the master DNS server.

Please comment your valuable feedback

Related Topics

Network Manager Command Line Interface nmcli

15 Scp commands to securely copy files from one Server to another Server

SELinux Security

Linux Boot Process RHEL 7 / Centos 7

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

2 Responses

  1. afif sarker says:

    its always help full.

  2. etp plant says:

    Nice weblog right here! Additionally your site quite
    a bit up very fast! What web host are you using? Can I get your associate link
    in your host? I want my web site loaded up as quickly as yours lol

Leave a Reply

Your email address will not be published. Required fields are marked *