Install and confgure DNS For RHEL/Centos/Fedora

by
Share this Article: Facebook0Google+0Twitter1LinkedIn0Reddit0StumbleUpon0

Build DNS server which resolves domain name or IP address. Install bind and caching-nameserver for it. And it’s also neccessary to configure router so that TCP and UDP packets to 53 can pass through.

[root@ns ~]# yum -y install bind caching-nameserver
Installed: bind.i386 30:9.3.3-8.el5 caching-nameserver.i386 30:9.3.3-8.el5
Complete!

Configure  BIND

Here is an example to configure BIND with named.conf.
This example is done with grobal IP address [172.16.0.80/29], Private IP address [192.168.0.0/24], Domain name [unixmen.net]. However, Please use your own IPs and domain name when you set config on your server. ( Actually, [172.16.0.80/29] is for private IP address, though. )

===============================================================

[root@unixmen.net ~]#  vi /etc/named.conf

options {

directory “/var/named”;

/*

* If there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below. Previous versions of BIND always asked

* questions using port 53, but BIND 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

allow-query { localhost; 192.168.0.0/24; };
// query range

allow-transfer { localhost; 192.168.0.0/24; };
// transfer range

allow-recursion { localhost; 192.168.0.0/24; };
// recursion range

};
controls {

inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};

// here is the section for internal informations

view “internal” {

match-clients {

localhost;

192.168.0.0/24;

};

zone “.” IN {

type hint;

file “named.ca”;

};

zone “unixmen.net” IN {

type master;

file “unixmen.net.lan”;

allow-update { none; };

};

zone “0.168.192.in-addr.arpa” IN {

type master;

file “0.168.192.db”;

allow-update { none; };

};

zone “localdomain” IN {

type master;

file “localdomain.zone”;

allow-update { none; };

};

zone “localhost” IN {

type master;

file “localhost.zone”;

allow-update { none; };

};

zone “0.0.127.in-addr.arpa” IN {

type master;

file “named.local”;

allow-update { none; };

};

zone “255.in-addr.arpa” IN {

type master;

file “named.broadcast”;

allow-update { none; };

};

zone “0.in-addr.arpa” IN {

type master;

file “named.zero”;

allow-update { none; };

};

};

// here is the section for external informations

view “external” {

match-clients {

any;

};

zone “.” IN {

type hint;

file “named.ca”;

};

zone “unixmen.net” IN {

type master;

file “unixmen.net.wan”;

allow-update { none; };

};

zone “80.0.16.172.in-addr.arpa” IN {

type master;

file “80.0.16.172.db”;

allow-update { none; };

};

};
include “/etc/rndc.key”;

// *note: For How to write for reverse resolving, Write network address reversely like below.

the case for 192.168.0.0/24
network address    ⇒ 192.168.0.0
range of network    ⇒ 192.168.0.0 – 192.168.0.255
how to write    ⇒ 0.168.192.in-addr.arpa

case of 172.16.0.80/29
network address    ⇒ 172.16.0.80
range of network    ⇒ 172.16.0.80 – 172.16.0.87
how to write   ⇒ 80.0.16.172.in-addr.arpa

====================================================
Source: serverworld sharing  knowlege

{loadposition user9}

Related Articles By Tags :

{loadposition user1}

For questions please refer to our Q/A forum at : http://ask.unixmen.com/

Share this Article: Facebook0Google+0Twitter1LinkedIn0Reddit0StumbleUpon0