Skip to main content

How to install dns server in centos 6


DNS helps to resolve domain name to ip address and ip address to domain name . In this post we can see how to configure DNS server on centos 6.

Install dns server in centos 6 :

Just follow the step by step instruction to setup dns server on centos 6 .
You can also refer the below posts for Centos OS installation and network configuration

» Centos 6 installation step by step screenshots

» How to setup network in centos 6

Step 1 » Install bind packages by issuing the below command.
[root@localhost ~]# yum install bind*

Step 2 » Assign static IP address.
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

Step 3 » Assign fully qualified domain name for the server ( Ex: )
[root@localhost ~]# vim /etc/sysconfig/network

Step 4 » Add a host entry in the host file .
[root@localhost ~]# vim /etc/hosts

Step 5 » Add server ip to the resolve.conf file.
[root@localhost ~]# vim /etc/resolv.conf

Just We completed pre requirements for DNS server . Lets start main configuration
Step 6 » Open /etc/named.conf file and Edit the following line Nos 11,12 and 17 like below
[root@localhost ~]# vim /etc/named.conf

Step 6 » Now open /etc/named.rfc1912.zones file and edit the following line nos 13,14,31 and 32
[root@localhost ~]# vim /etc/named.rfc1912.zones

Step 7 » Now create forward and reverse zone files like below
[root@localhost ~]# cp /var/named/named.localhost /var/named/
[root@localhost ~]# cp /var/named/named.loopback /var/named/

Step 8 » Open the forward zone file and replace with your hostname like below
[root@localhost ~]# vim /var/named/

Step 9 » Now open the reverse zone file and replace like below .
[root@localhost ~]# vim /var/named/

Step 10 » Now set group permissions for the files

[root@localhost ~]# chgrp named /var/named/
[root@localhost ~]# chgrp named /var/named/

Step 11 » That’s it , now start the service by typing the below command

Step 12 » Issue the below command to start service on bootup and Reboot the server
[root@localhost ~]# chkconfig --levels 235 named on

Step 13 » After rebooting .Just issue the below commands to test your dns server
[root@dns1 ~]# dig

All the best