Advance

Tutorial Setup private DNS server on centos 8/7

Setup private DNS server on centos 7
1
(1)

Learn how to Setup private DNS server on centos 8/7. Simply put, a Domain Name System (DNS) is a hierarchical distribution naming system for computers, services, or any resource connected to the Internet or private network that handles information about the various domains assigned to each website and company. Most importantly, it translates into a meaningful and human-friendly domain name and numeric identifier associated with network equipment in order to locate and address these devices around the world. In fact, the dns server connects the domain to a server. In this post, you will learn how to install a private dns server on Linux in the centos version 8 or 7 distribution. You can visit the packages available in Eldernode to purchase CentOS VPS server.

Setup private DNS server on centos 8/7

In the following, we will introduce you to the Setup private DNS server on centos 8 or centos 7 process. Suppose you have a server with IP 192.168.12.8 and you also have a domain called eldernode.com. The first step is to install the BIND package and then configure it. Finally create the Zone files. Follow us in the continuation of this tutorial.

Note: You must replace your IP address and website address with the instructions in this article.

Recommended Article: Tutorial Install BlueOnyx On Centos 7

How to install BIND package on CentOS 8 or Centos 7

BIND stands for Berkeley Internet Name Domain, which is software that provides the ability to convert a domain name to an IP. To execute commands either to install BIND DNS Server on CentOS 7 or to configure BIND DNS Server on CentOS 8 or centos 7 you need root server access to be able to connect to your server using SSH. You can install BIND using the following command:

yum -y install bind bind-utils

How to configure BIND on CentOS 8 or centos 7

The bind file for the bind service is located at etc/named.conf/. Open the etc/named.conf/ file and put the following two command lines in comment mode:

# listen-on port 53 {127.0.0.1; };
# listen-on-v6 port 53 {:: 1; };

Now you need to add your network in the line below. For example in the following command I have added 192.168.12.0/24. This allows customers on the network to use DNS to translate the name to IP:

allow-query {localhost; 192.168.12.0/24; };

If you want to move all zones to the server (192.168.12.6), add the following line: (Optional)

allow-transfer {192.168.12.6; };

Learn how to create Zone files

In the following commands, we have written a zone for the domain eldernode.com, which is added to the named.conf file:

zone "eldernode.com" IN {  type master;  file "fwd.eldernode.com.db";  allow-update { none; };  };

The following example is a reverse entry in the named.conf file called the reverse zone:

zone "12.168.192.in-addr.arpa" IN {  type master;  file "12.168.192.db";  allow-update { none; };  };

In the example above:

12.168.192.in-addr.arpa is the name of the reverse reference.

Master represents the primary dns.

12.168.192.db is a reverse lookup file.

allow-update: Since this is the original DNS, it should not have it, which is why we set it to none.

How to create a lookup file for a zone

Now it is time to create a lookup file for a zone. By default, lookup files in the zone are located in the var/named/ folder. So you need to create a zone file called fwd.eldernode.db for forward lookup in this folder.

Note that all domain names must end with a dot.

Here are some keywords specific to Zone Files:

A – A record
NS – Name Server  
MX – Mail for Exchange  
CNAME – Canonical Name

Well, open the created zone file using the following command:

vi /var/named/fwd.nginxweb.ir.db

Now enter the following content:

$TTL 86400  @   IN  SOA     primary.eldernode.com. root.eldernode.com. (  2014112511  ;Serial  3600        ;Refresh  1800        ;Retry  604800      ;Expire  86400       ;Minimum TTL  )  ;Name Server Information  @      IN  NS      primary.eldernode.com.  ;IP address of Name Server  primary IN  A       192.168.12.8  ;Mail exchanger  eldernode.com. IN  MX 10   mail.eldernode.com.  ;A - Record HostName To Ip Address  www     IN  A       192.168.12.100  mail    IN  A       192.168.12.150  ;CNAME record  ftp     IN CNAME        www.eldernode.com.

Create a “zone” file called 12.168.192.db for the “reverse zone” under the var/named/ folder. Also set a reverse pointer for the above zone:

PTR – Pointer  SOA – Start of Authority

 

# vi /var/named/12.168.192.db    $TTL 86400  @   IN  SOA     primary.eldernode.com. root.eldernode.com. (  2014112511  ;Serial  3600        ;Refresh  1800        ;Retry  604800      ;Expire  86400       ;Minimum TTL  )  ;Name Server Information  @ IN  NS      primary.eldernode.com.  ;Reverse lookup for Name Server  8        IN  PTR     primary.eldernode.com.  ;PTR Record IP address to HostName  100      IN  PTR     www.eldernode.com.  150      IN  PTR     mail.eldernode.com.

After creating the zone files, restart the bind service again.

 systemctl restart named.service

You can also enable the service to start at startup using the following command:

 systemctl enable named.service

You were able to successfully install, configure and set up a dns server on centos 8/7. Now if you do it right, your domain will connect to the server.

Conclusion

BIND software is one of the default DNS software and of course the most popular software of this service, which is specifically for Unix/Linux operating systems. Its main functionality in DNS Server is to translate the domain name into an IP address. Installing and configuring BIND on Linux servers is one of the most important things in server configuration. In this article, we tried to teach you how to setup a private DNS server on centos 8 or centos 7.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

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

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day