You can Watch all our Tutorials and Training Videos on our YouTube Channel for Free! Subscribe Now! & Free Web Tools available on

How to Create DNS Server in CentOS?

How to Create DNS Server in CentOS, ?, linux dns server, linux dns server configuration, simple dns server linux, configure dns, DevOps, DNS, DNS
How to Create DNS Server in CentOS

A DNS (Domain Name System) server is an important component of any network that allows clients to resolve domain names into IP addresses. If you are using CentOS as your server operating system, you can easily set up your own DNS server using BIND (Berkeley Internet Name Domain).

In this tutorial, we will guide you through the process of setting up a DNS server on CentOS using BIND. We assume that you already have a CentOS server set up and running.

Setting up BIND DNS Server on CentOS

Step 1: Installing BIND

First, you need to install BIND on your CentOS server. To do this, open a terminal window and enter the following command:

sudo yum install bind bind-utils

This command will install BIND and some useful utilities that you can use to manage your DNS server.

Step 2: Configuring BIND

Once BIND is installed, you need to configure it to act as a DNS server. The configuration file for BIND is located at /etc/named.conf. You can open this file using your favorite text editor, such as vim or nano.

sudo nano /etc/named.conf

The named.conf file contains the main configuration settings for your DNS server. You can modify this file to suit your needs, but for most users, the default configuration should work fine.

Step 3: Creating Zone Files

Now that BIND is installed and configured, you need to create zone files for your DNS server. Zone files contain the mappings between domain names and IP addresses. You can create zone files using a text editor and save them in the /var/named directory.

For example, to create a zone file for the domain, you can create a file called /var/named/ and enter the following information:

$TTL 86400
@ IN SOA (
2023042601 ; serial number
7200 ; refresh
3600 ; retry
1209600 ; expire
86400 ; minimum TTL
ns1 IN A
www IN A
mail IN A

This zone file defines the domain, with a DNS server at and three hosts with IP addresses,, and

Step 4: Starting BIND

Once you have created your zone files, you can start BIND using the following command:

sudo systemctl start named

This will start the BIND service and make your DNS server available to clients on your network.

Step 5: Testing Your DNS Server

To test your DNS server, you can use the nslookup command on a client machine. For example, to look up the IP address of, you can enter the following command:


This should return the IP address, which is the IP address of the host defined in the zone file.

Setting up a DNS server on CentOS is a straightforward process that can be accomplished in just a few steps. With your own DNS server, you can easily manage your network's domain name resolution and ensure that your clients can access resources on your network with ease.

Related Searches and Questions asked:

  • How to Set DNS Server in Linux Ubuntu?
  • How to Find DNS on Linux Command?
  • Linux DNS Server Configuration
  • How to Set DNS Server in Ubuntu Command Line?
  • That's it for this post. Keep practicing and have fun. Leave your comments if any.

    Post a Comment

    Cookie Consent
    We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
    It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
    AdBlock Detected!
    We have detected that you are using adblocking plugin in your browser.
    The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
    Site is Blocked
    Sorry! This site is not available in your country.