Hello Guy's
TO CONFIGURE DNS SERVER IN LINUX (ABOUVE 5.1 Version to bellow 6.0 Version)
############# DNS MASTER SERVER Configration ######################
########## Server ip 192.168.0.254 (DNS Master)####################
###################################################################
### Give static ip by using setup command##########################
#setup
ip = 192.168.0.254
mask = 255.255.255.0
gatway = 192.168.0.254
###################### Edit network file###########################
#vim /etc/sysconfig/network
HOSTNAME=server22.example.com
###################################################################
#vim /etc/hosts
#vim /etc/resolve.conf
chech the ip and domain name.
###################################################################
##################### Restart network service######################
#service network restart
###################################################################
##### Install DNS Packages ( bind, caching-nameserver)#############
#yum install bind* caching-nameserver* -y
###################################################################
#ls /var/named/chroot/etc/*
localtime
named.caching-nameserver.conf
named.rfc1912.zone
rndc.key
## copy named.caching-nameserver.conf file to named.conf file######
#cp named.caching-nameserver.conf named.conf
############ check permission of named.conf file###################
#ls -l
-rw-r----- 1 root root 1230 jul 23 22:25 named.conf
#chgrp named named.conf
#ls -l
-rw-r----- 1 root named 1230 jul 23 22:25 named.conf
############### Edit named.conf file like this#####################
----------------------------------------------------
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
#acl internal { 192.168.0.0/24; };
#acl external { 192.168.1.0/24; 192.168.2.0/24; };
options {
listen-on port 53 { 127.0.0.1; 192.168.0.254; };
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";
// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;
allow-query { localhost; 192.168.0.0/24; 192.168.1.0/24; };
allow-query-cache { localhost; 192.168.0.0/24; 192.168.1.0/24; };
allow-transfer { 192.168.0.10; };
forwarders { 192.168.1.0; 192.168.2.0; };
forward only;
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { localhost; 192.168.0.0/24; 192.168.1.0/24; };
match-destinations { localhost; 192.168.0.0/24; 192.168.1.0/24; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
(save + exit)
-------------------------------------------------------
### Edit another file named.rfc1921.zone
----------------------------------------
################################################################
zone "coss.com" IN {
type master;
file "coss.flz";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "coss.rlz";
allow-update { none; };
};
#######################################################################
----------------------------------------
(save + exit)
### Then check your named.conf file all syntax through command#####
#named-chkconf named.conf
### if no error come it means your all syntax is ok otherwise read error then
### solve it & again run named-chconf command
#### change your current Directory & listed out ##################
#ls /var/named/chroot/var/named/*
drwxrwx--- 2 named named 4096 Aug 26 2004 data
-rw-r----- 1 root named 198 Jul 30 2009 localdomain.zone
-rw-r----- 1 root named 195 Jul 30 2009 localhost.zone
-rw-r----- 1 root named 427 Jul 30 2009 named.broadcast
-rw-r----- 1 root named 1892 Jul 30 2009 named.ca
-rw-r----- 1 root named 424 Jul 30 2009 named.ip6.local
-rw-r----- 1 root named 426 Jul 30 2009 named.local
-rw-r----- 1 root named 427 Jul 30 2009 named.zero
drwxrwx--- 2 named named 4096 Jul 27 2004 slaves
### copy 2 files
#cp /var/named/chroot/var/named/localhost.zone /var/named/chroot/var/named/coss.flz
&
#cp /var/named/chroot/var/named/named.local /var/named/chroot/var/named/coss.rlz
### Then change group
#chgrp named /var/named/chroot/var/named/coss.flz
&
#chgrp named /var/named/chroot/var/named/coss.rlz
############# Edit coss.flz file like this#######################
-----------------------------------------------
$TTL 86400
@ IN SOA ns1.coss.com. root.ns1.coss.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS ns1.coss.com.
IN A 192.168.0.248
IN MX 10 mail.coss.com.
ns1 IN A 192.168.0.248
myweb IN A 192.168.0.1
mymail IN A 192.168.0.2
sports IN A 192.168.0.3
news IN A 192.168.0.4
www IN CNAME myweb.coss.com.
mail IN CNAME mymail.coss.com.
-------------------------------------------------
(save + exit)
############ Edit coss.rlz file like this########################
------------------------------------------------
$TTL 86400
@ IN SOA ns1.coss.com. root.ns1.coss.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns1.coss.com.
248 IN PTR ns1.coss.com.
1 IN PTR myweb.coss.com.
2 IN PTR mymail.coss.com.
3 IN PTR sports.coss.com.
4 IN PTR news.coss.com.
------------------------------------------------
(save + exit)
### Check zone files through named-checkzone command
note:use in /var/named/chroot/var/named/ directory only
#named-checkzone flz example.flz
&
#named-checkzone rlz example.rlz
############# restart named service############################
#service named restart
#chkconfig named on
------------------------------------------END----------------------------------------------
If you have linux 5.1 version the configuration file path was different
[root@server ~]# vim /etc/named.caching-nameserver.conf
ABOCE VERSION ARE /etc/named.conf
No comments:
Post a Comment