DNS Server Installation Step by Step in Linux RHEL/CentOS 6.x

Posted: February 23, 2014 in DNS
Tags: ,

DNS helps to resolve domain name to IP address and IP address to domain name. The domain name system (DNS) is the way that Internet domain names are located and translated into Internet Protocol addresses. A domain name is a meaningful and easy-to-remember “handle” for an Internet address.

In this post we’ll see how to configure DNS server on RHEL/CentOS 6.x

Features:

  • Name-to-IP address mapping
  • Name resolution for DNS clients
  • Caching-only server (Defaults)
  • Primary DNS server
  • Slave server
  • Replication of DNS database information between servers
  • Dynamic DNS updates
  • Provides numerous client tolls: nslookup, dig

Installing DNS Server:

Just follow the step by step instruction to setup dns server.

[1] Install bind packages by issuing the below command.
[root@ns ~]# yum install bind* -y

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

DEVICE=“eth0”
BOOTPROTO
=”none”
DEFROUTE=
“yes”
DNS1=
“10.10.12.143”#MUST CHANGE THIS TO YOUR HOST IP ADDRESS!!
GATEWAY=
“10.10.12.1”
HWADDR=
“86:C4:C1:0D:29:AD”
IPADDR=
“10.10.12.143”
NM_CONTROLLED=
“yes”
ONBOOT=
“yes”
PREFIX=
“24”
TYPE=
“Ethernet

[3] Assign fully qualified domain name for the server (Ex: ns.example.com)

[root@ns ~]# vim /etc/syscofig/network

NETWORKING=yes
HOTNAME=ns.example.com

[4] Add a host entry in the host file.

[root@ns ~]# vim /etc/hosts

10.10.12.143    ns.example.com

[5] Add server ip to the resolv.conf file.
[root@ns ~]# vim /etc/resolv.conf

Search example.com
nameserver 10.10.12.143

[6] Now open /etc/named.conf file and edit the file

DNS

[7] Now create forward and reverse zone files that servers resolve IP address from domain name like below in /var/named directory.

[a] This example uses [10.10.12.0/24], domain name [ns.example.com], but please use your own one when you set config on your server.

[root@ns ~]# vim /var/named/example.com.fz

$TTL 86400

@ IN SOA ns.example.com. root.example.com. (

    2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)

# define name serve
IN NS ns.example.com.

# internal IP address of name server
IN A 10.10.12.143

# define Mail exchanger
IN MX 10 ns.example.com.

# define IP address and hostname
ns IN A 10.10.12.143

# alias IN CNAME server’s name
ftp     IN CNAME     ns.example.com.

Set Zone for reverse resolution 
Create zone file that servers resolve domain names from IP address.
 

[b] This example uses [10.10.12.0/24], domain name [ns.example.com], but please use your own one when you set config on your server.

[root@ns ~]# vim /var/named/example.com.fz

$TTL 86400

@ IN SOA ns.example.com. root.example.com. (

    2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)

# define name serve
IN NS ns.example.com.

# define range that this domain name is in
IN PTR example.com.

# define IP address and hostname
143 IN PTR ns.example.com.

[8] Now set group permissions for the above create files

[root@ns ~]# chgrp named /var/named/example.com.fz
[root@ns ~]# chgrp named /var/named/12.10.10.db

[9] Now start the service by typing the below command

[root@ns ~]# /etc/rc.d/init.d/named sart

[10] Issue the below command to start service on bootup and Reboot the server

[root@ns ~]# chkconfig named on

[11] Checking whether DNS queries has been resolved or not by issuing the below command.

[root@ns ~]# nslookup ns.example.com

You should see something like this

Server:    10.10.12.143
Address:    10.10.12.143#53

Name:    ns.example.com
Address:    10.10.12.143

[root@ns ~]# nslookup 10.10.12.143
Server:    10.10.12.143
Address:    10.10.12.143#53

143.12.10.10.in-addr.arpa        name = ns.example.com

[root@ns ~]# dig ns.example.com
[root@ns ~]# dig -x 10.10.12.143
[root@ns ~]# dig -t mx example.com

Advertisements
Comments
  1. […] Install & Configure DNS server in Linux RHEL/CentOS 6.x […]

  2. Kevin Lee says:

    Hallo,

    Such vivid info on the DNS Server Installation Step by Step in Linux RHEL/CentOS 6.x! Flabbergasted! Thank you for making the read a smooth sail!

    I want to learn Linux.
    I have an idea for an application that I want to be open source.
    I fairly technical (Cisco CCNP) and I’m good with tshooting but I don’t want to waste hours of my time narrowing down the root cause of some insignificant thing. I would rather pay someone else to give me the answer (I understand Red Hat has technical support I can pay for).
    These virtual files have unique qualities. Most of them are listed as zero bytes in size. Virtual files such as /proc/interrupts, /proc/meminfo, /proc/mounts, and /proc/partitions provide an up-to-the-moment glimpse of the system’s hardware.
    Please keep providing such valuable information.

    Shukran,
    Kevin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s