Redhat / DNS Server Installation and Configuration on Centos 7 – Bind (Named), NS (Nameserver) – Public DNS Or Private DNS

What is DNS? What is NS?

I would like to refer many questions like this to related articles and make a direct transition to this topic.

Note: The domain to be used in the article is, ips are not real.

In Linux systems, you need to install the DNS system and install the Bind package to activate it. The name of the service is known as Named. With Named you can provide service management.

In the first place, I install a Centos 7 server and then use a fixed IP to lift up the network. Then run yum update command to stabilize the server. Then, I change the hostname of the server to from the file “/etc/hostname” . I also make this change in the file “/etc/hosts” . In the meantime, after updating and installing the packages, make sure to show yourself as a DNS server from the files “/etc/resolv.conf” and “/etc/sysconfig/network-scripts/ifcfg-ens0”.

Then let’s install the necessary packages for DNS with the following command.

Now the important part is the configuration and we will configure the file et  “/etc/named.conf”   first, but make a backup of the “named.conf” file first.

By default, the content of “named.conf” is like ss below.


Let’s talk about what will be changed or added before editing the file with the help of an editor.

The default lines are;

The shape will change;

Rows to be added;

forward only; //optional

forwarders {; }; //optional

Zone and reverse zone information of – is specified in this file.

The final screenshot is as follows.

Now it’s time to create zone files, that is, DNS records. We need to create these zone and revzone files in the directory “/ var / named /” and in the “/etc/named.conf”  directory names.

Let’s go to the directory first.

Finally, I enter the contents of the “” and “100.34.203.revzone” zone files through any editor as shown in the ss below.

Note: I added A, CNAME and PTR records as an example. The other configuration types are important because the zone and revzone are different because I have added both types to be an example.;


Now that’s all right up to, but all we have to do is test the accuracy of all these adjustments.

First, check if we have correctly configured “/etc/named.conf”. If something doesn’t turn, it’s true.

Now let’s check the file.

Finally, check the file 100.34.203.revzone.

Now that everything’s fine, let’s start the named service.

Finally, let’s make sure he listens to port 53. Remember to allow access to port 53 from the firewall.

Everything on the server-side is over, let’s redirect a user machine’s DNS to our new server and check the status of decoding records.


I hope it has been a useful article.