Search My Blog

Saturday, April 26, 2014

How to set up a primary DNS server using CentOS - Linux FAQ

Here's a good Series on How to set up a primary DNS server using CentOS and How to set up a secondary DNS server in CentOS. These articles, show you, step by step. How to set your server up for this. From Xmodulo Linux FAQs, tips and tutorials. Read More below...


How to set up a primary DNS server using CentOS

Any operational domain has at least two DNS servers, one being called a primary name server (ns1), and the other a secondary name server (ns2). These servers are typically operated for DNS failover: If one server goes down, the other server becomes an active DNS server. More sophisticated failover mechanisms involving load balancers, firewalls and clusters are also possible.

All DNS entries for a particular domain are added in the primary name server. The secondary server will simply sync all the information from the primary name server based on counter type parameter set on the primary server.

This tutorial will describe how to create a primary DNS server running on CentOS. Please note that the DNS server presented in this tutorial will be public DNS, meaning that the server will respond to queries from any IP address. Limiting access to the server will be discussed in future tutorials.

Before we start, I would like to mention that DNS can be set up with or without chroot jail environment. The chroot jail environment confines the DNS server to a certain directory in the system, as opposed to allow the server system-wide access. That way, any vulnerability of the DNS server would not compromise the entire system. Chrooting a DNS server is also useful for a test deployment.


We will be setting up a DNS server in a test environment for the domain example.tst, which is a hypothetical (non-existing) domain. That way, we will not accidentally interfere with any other live domain.

In this domain, there are the following three servers.

Server IP address Hosted services FQDN
Server A Mail mail.example.tst
Server B Web, FTP www.example.tst
Server C Primary DNS server ns1.example.tst

We will be setting up a primary DNS server, and add necessary domain and DNS records as shown in the table.

Setting up hostnames


How to set up a secondary DNS server in CentOS

In the previous tutorial, we created a primary DNS server (ns1) for a test domain example.tst. In this tutorial, we will create a secondary DNS server (ns2) for the same domain by using bind package on CentOS.

When it comes to setting up a secondary DNS server, the following factors should be kept in mind.

  • You do NOT need to manually create forward and reverse zone files in the secondary DNS server. The zone files will be periodically synced from the primary DNS server automatically.
  • Whenever any zone file is modified in the primary DNS server, the parameter 'serial' should be updated. The secondary DNS server will initiate synchronization (zone transfer) only if serial at the primary server has been changed.

We assume that the IP address of the secondary DNS server to be set up is Let us start installing.

Setting up Hostnames


CentOS info...

CentOS FTP Direct Downloads - Index of - content
About/Product - CentOS Wiki
Index of
DonsDeals: CentOS - TUI's text-based user interfaces, available from the official CentOS repository for system administration using text-based user interfaces
Index of /2.1/final/isos - content - The Community ENTerprise Operating System
HowTos/Laptops - CentOS Wiki
HowTos - CentOS Wiki - FAQ - General CentOS Questions - Can I add X to my server after install? or I installed from the Server ISO and it didn't install X, how do I install X?
Index of /6.2/isos/i386
The Perfect Server - CentOS 6.2 x86_64 With nginx [ISPConfig 3] | HowtoForge - Linux Howtos and Tutorials
Control Panels | HowtoForge - Linux Howtos and Tutorials
Apache | HowtoForge - Linux Howtos and Tutorials
DonsDeals: CentOS Overview CentOS
centos - Google Search
CentOS Product Specifications
FrontPage - CentOS Wiki - FAQ - General CentOS Questions
Index of /CentOS/6.2/isos/i386
Manuals/ReleaseNotes/CentOS6.2 - CentOS Wiki
CentOS - Google Search
DonsDeals: CentOS 5.6: The Reliable Server OS Gets a Revamp | Wazi - The Community ENTerprise Operating System
Download - CentOS Wiki
Manuals/ReleaseNotes - CentOS Wiki
Manuals/ReleaseNotes/CentOSMinimalCD6.5 - CentOS Wiki
Index of /centos/6.5/isos/i386
Manuals/ReleaseNotes/CentOS6.4 - CentOS Wiki
Manuals/ReleaseNotes/CentOS6.5 - CentOS Wiki
Google Custom Search for CentOS
SME Server
How to set up MailScanner, Clam Antivirus and SpamAssassin in CentOS mail server - Linux FAQ
How to set up a secondary DNS server in CentOS - Linux FAQ
How to set up a primary DNS server using CentOS - Linux FAQ
How to set up and secure Apache web server under CentOS

No comments: