How to configure DNS on RHEL5.
Version : 1.0
Date : 27-06-2011
Written by : Hafiz Muhammad Amir
Before configuring any server check you hostname it should be FQDN(Fully Qualified
Domain Name)
by command
#hostname
centos.ali.com
If the command does not show the FQDN name then open the file
#vi /etc/sysconfig/network
and edit this line to
HOSTNAME=centos.ali.com
save and exit the file.
# reboot the machine and verify the hostname command.
RedHat starting from version RHEL4 has included extras layer of security with the
name of SELINUX.
Configure selinux properly for specific services like bind,apache,squid,dhcp,ftp etc
otherwise disable it completely.
(Dont keep it just enable without proper configuration).
To check the status of selinux
#sestatus
SELinux status:
disabled
If it is enable on you system then open the file
# vi /etc/sysconfig/selinux
and the change the following line to
SELINUX=disabled
and save the file.
(When ever you change the status of selinux you have to reboot the machine)
-check the bind package
#rpm -qa |grep ^bind
bind-9.3.3-7.el5
bind-utils-9.3.3-7.el5
bind-chroot-9.3.3-7.el5
bind-libs-9.3.3-7.el5
# rpm -q caching-nameserver
cahing-nameserver-9.3.3-7.el5
go the direcoty
# cd /var/named/chroot/etc
In this file will be with the name of named.caching-nameserver.conf
copy this file in the same directory with the name of named.conf
# cp named.caching-nameserver.conf named.conf
Change the group of named.conf file
# chown root.named named.conf
make the symbolic link of named.conf in the /etc dir
# ln -s /var/named/chroot/etc/named.conf /etc/named.conf
# Now open named.conf file and change the followings lines.
Add ip address of server in bracket.
# vi named.conf
listen-on port 53 { 127.0.0.1;192.168.20.100; };
//
// I am using here simple approach of single view.For more advance configuration
// named.conf required multiple views which will be discussed Inshalla later on.
//
Add any in allow-query
allow-query
{ localhost; any; };
Add any in localhost_resolver
view localhost_resolver {
match-clients
{ localhost;
any;
};
save and exit the file.
Now check the systax error of this file by this command
#named-checkconf
Now open another file in the same directory
# vi named.rfc1912.zones
and change the localdomain to your domain name
zone "ali.com" IN {
type master;
file "alirecordfile.zone";
};
and save the file
#now to the the directory
# cd /var/named/chroot/var/named/
In this directory you will see a file named.local copy this file with the same names as
you have
mettioned in named.rfc1912.zones in zone information of your domain (in tab of
file"alirecordfile.zone")
# cp named.local alirecordfile.zone
Change the group of this file.
#chown root.named alirecordfile.zone
Now open this file
#vi alirecordfile.zone
and change the localhost with your fully Qualified Domain name like
$TTL 86400
@
IN
SOA
centos.ali.com. root.localhost. (
1997022700 ; Serial
28800
; Refresh
14400
; Retry
3600000 ; Expire
86400 ) ; Minimum
IN
NS
centos.ali.com.
centos.ali.com. IN A 192.168.20.100
ali.com. IN A 192.168.20.100
Delete the PTR line from this file.
And record the record in this file ans mention above.
Pay special attention to DOT in this file.
There should alwayes be DOT at the end of record named as
centos.ali.com. IN A 192.168.20.100
There must not be DOT at end of ip address
Then save and exit this file.
Now start/restart the named servics.
# service named restart
And check the log file /var/log/messages carefully for any error message
#Now open the file /etc/resolv.conf to the the cleint about its DNS server
# vi /etc/resolv.conf
and add this line
nameserver 192.168.20.100
save and exit the file.
#Then check DNS from you cleint machine by commands, host,nslookup ,dig
like
#dig
centos.ali.com
There should a Answer section in your output which will show the desired query
answer.
;; ANSWER SECTION:
centos.ali.com.
86400 IN
A
192.168.20.100
Kindly : Send you feedback at engamirch@gmail.com to improve documents
My url = engamir.blogspot.com

No comments:
Post a Comment