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
- Primary / Master DNS
- Slave DNS
- Forwarding DNS
- Caching DNS
- 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/named.rfc1912.zone
- 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 { 127.0.0.1; 192.168.4.128; }; 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; 192.168.4.0/24; };
(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 "arkit.com" IN { type master; file "arkit.for.zone"; allow-update { none; }; }; zone "4.168.192.in-addr.arpa" IN { type master; file "arkit.rev.zone"; 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 “arkit.com” IN { in this line whatever the domain name you would like to configure mention that
file “arkit.for.zone”; file name whatever the file name you want you can give
zone “4.168.192.in-addr.arpa” IN { in this line write your IP address in reverse way
file “arkit.rev.zone”; 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 –> arkit.for.zone
named.loopback –> arkit.rev.zone
# cd /var/named/chroot/var/named
# cp named.localhost arkit.for.zone
# cp named.loopback arkit.rev.zone
# vim arkit.for.zone
$TTL 1D
@ IN SOA techtutorial.arkit.com. root.techtutorial.arkit.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
;DNS Server Name Records @ IN NS techtutorial.arkit.com. @ IN NS slave.arkit.com. ;Name Servers Host name to IP @ IN A 192.168.4.128 @ IN A 192.168.4.129 ;Hosts in this domain records @ IN A 192.168.4.128 @ IN A 192.168.4.129 techtutorial IN A 192.168.4.128 slave IN A 192.168.4.129
As shown in above configuration server.techtutorial.arkit.com. – 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 arkit.rev.zone $TTL 1D @ IN SOA techarkit.arkit.com root.techarkit.arkit.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum ;Name Servers @ IN NS techarkit.arkit.com. @ IN NS slave.arkit.com. @ IN PTR arkit.com. ;Name Servers Hostname to IP Address @ IN A 192.168.4.128 @ IN A 192.168.4.129 ;Domain records 128 PTR techarkit.arkit.com. 129 PTR slave.arkit.com.
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 arkit.for.zone # chown root:named arkit.rev.zone
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 search arkit.com domain arkit.com nameserver 192.168.4.128
verify master dns server
# nslookup arkit.com #dig arkit.com #host 192.168.4.128 #dig -x 192.168.4.128
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
Linux Boot Process RHEL 7 / Centos 7
Thanks for your wonderful Support and Encouragement