DNS howto's for RHEL5

Share your expert knowledge and show off your skills.
Post Reply
CyberBob
Cadet
Posts: 8
Joined: Wed Mar 12, 2008 11:44 am
Location: End of Road. . . .
Contact:

DNS howto's for RHEL5

Post by CyberBob »

Some people think that configuring dns in rhel5 is a little bit tricky. I have included a howto on configuring dns in rhel5. please help me with your feed back to improve this document. please contact me cyberbob.thedarklord@gmail.com
you can also reach me at irc, i m available on freenode as

cyberob



How to configure DNS on RHEL5.



Before configuring any server check your hostname it should be FQDN(Fully Qualified Domain Name)
by command

changing hostname in run level 3 may be in run level 5 machine will hange***

#init 3

#hostname pc1.cyberdyne.net

#hostname
pc1.cyberdyne.net


#vi /etc/sysconfig/network
and edit this line to

HOSTNAME=pc1.cyberdyne.net

save and exit the file.
# reboot or change run level
# init 5


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

----------------------------BIND configration--------------------------------------


#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.0.254; };

//
// 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 "cyberdyne" IN {
type master;
file "cyberdyne.forzone";
};

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"cyberdyne.forzone")

# cp named.local cyberdyne.forzone

Change the group of this file.
#chown root.named cyberdyne.forzone

Now open this file

#vi cyberdyne.forzone

and change the localhost with your fully Qualified Domain name like

$TTL 86400
@ IN SOA pc1.cyberdyne.net. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS pc1.cyberdyne.net.


pc1.cyberdyne.net. IN A 192.168.0.254
ali.com. IN A 192.168.0.254


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
pc1.cyberdyne.net. IN A 192.168.0.254
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.0.254

save and exit the file.

#Then check DNS from you cleint machine by commands, host,nslookup ,dig

like

#dig pc1.cyberdyne.net

There should a Answer section in your output which will show the desired query answer.

;; ANSWER SECTION:
pc1.cyberdyne.net. 86400 IN A 192.168.0.254
Post Reply