Linux is a free Unix-type operating system originally created by Linus Torvalds with the assistance of developers around the world. Developed under the GNU General Public License , the source code for Linux is freely available to everyone
Tuesday, January 19, 2010
How to configure DNS server in linux(BIND)
Yum install bind*
Now edit /etc/named.conf file according to the example below.
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { 127.0.0.1; 192.168.1.6; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
query-source port 53;
query-source-v6 port 53;
allow-query { localhost; 192.168.1.0; 192.168.1.6; };
forwarders { 192.168.1.6; };
};
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
type hint;
file "named.ca";
};
zone "xyz.com" {
type master;
file "xyz.com.zone";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "192.168.0.zone";
};
now save exit file.
Second step- Now make & configure forward & reverse zone. In following destination path.
$ cd /etc/var/named/chroot/var/named/
$ cp localhost.zone xyz.com.zone
$ cp named.local 192.168.0.zone
$ vim xyz.com.zone
$TTL 86400
xyz.com. IN SOA host.xyz.com. root.host.xyz.com. (
46
3H
15M
1W
1D )
@ IN NS host.xyz.com.
host.xyz.com. IN A 192.168.1.6
host2.xyz.com. IN A 192.168.1.7
$ vim 192.168.1.0.zone
$TTL 86400
0.168.192.in-addr.arpa. IN SOA host.xyz.com. root.host.zyz.com. (
2008082915 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS host.xyz.com.
6 IN PTR host.xyz.com.
7 IN PTR host2.xyz.com.
now save both file & exit
Step -3
change group ownership in bith file
$ chgrp named xyz.com.zone
$ chgrp named 192.168.1.0.zone
now restart named service
$ /etc/init.d/named restart