Install and Configure DNS on Linux Server

You would need to configure DNS server on the server, like bind:
yum install bind bind-utils

backup your bind config
mv /etc/named.conf /etc/named.conf_backup

create and edit new config

pico /etc/named.conf

and paste this config to the file:

###begin
options {
recursion no;
allow-query { any; };
allow-query-cache { any; }
;
};
zone “yourdomain.com” {
type master;
file “/var/named/yourdomain.com”;
};
###end

than you should create your domain zone file:

pico /var/named/yourdomain.com

#dns zone begin
$TTL 3600
yourdomain.com. IN SOA SKRS969.local. root.SKRS969.local. (2015021702 10800 3600 604800 86400)
yourdomain.com. IN NS ns1.yourdomain.com.
yourdomain.com. IN NS ns2.yourdomain.com.
yourdomain.com. IN MX 10 mail.yourdomain.com.
yourdomain.com. IN A 12.34.56.78
ns1 IN A 1.2.3.4
ns2 IN A 1.2.3.4
www IN CNAME yourdomain.com.
mail IN A 5.6.7.8
#dns zone end

where 1.2.3.4 – this server IP (dns server with bind)
5.6.7.8 – your MX mail server IP
12.34.56.78 – your webserver IP

or if dns, web and mail server are located on the same server – put one IP

restart DNS bind service:

/etc/init.d/named restart

Than you should registered nameservers for your domain in your domain registration site (ns1.yourdomain.com 1.2.3.4 , ns2.yourdomain.com 1.2.3.4) and than change NS for your domain to ns1.yourdomain.com and ns2.yourdomain.com.

Before changing NS on registrator site you can check is your bind work properly:

#dig @localhost yourdomain.com

you should get something like:

;; ANSWER SECTION:
yourdomain.com. 3600 IN A 1.2.3.4

;; AUTHORITY SECTION:
yourdomain.com. 3600 IN NS ns1.yourdomain.com.
yourdomain.com. 3600 IN NS ns2.yourdomain.com.

Comments are closed.

(adsbygoogle = window.adsbygoogle || []).push({}); //--> Feedjit Flag Counter