Thursday, December 2, 2010

DNS [ Domain Name Server / System ]

           DNS [ Domain Name Server / System ] For RHEL 4

If we want to register multiple domains and wish to give same Ip address for those sites then DNS is used. If client user enters url names then DNS is used to understand that name and searches the particular Ip address of that site. It acts as a mediator between user and rest internet.

To check the rpm of DNS is installed or not give command :

rpm -qa | grep bind*

Here name of DNS service is “named” and package name is “bind
BIND : Berkely Internet Named Domain

edit “/etc/named.conf ” file. If this file is not there then move /etc/named.custom file to the same location with “named.conf” or copy it,

i.e. # cp /etc/named.custom /etc/named.conf

# vim /etc/named.conf

1) controls : from where this file gets modified.
2) Zone : the format of zone file is very important.

Zone “.” IN {
type hint;
file “” // the name of file containing zone records.
zone “localhost” IN {
type master;
file “”;
allow-update {none};

First two zones are called as Forward lookup zones. In that client give the name and dns server returns the Ip address for that name. After that the type come named “reverse lookup zone”. In that client give Ip address and the DNS server returns the DNS name of that Ip address.
i.e. 1) if in forward lookup zone the url is like “” then in reverse lookup zone it becomes “”
2) I fin forward lookup zone the Ip address is “” then in reverse lookup zone it becomes “”. And the “.10” gets stored in records of RLZ.
3) Zone “” IN {
type master;
file “named.conf”;
allow-update { none; };
make changes as next line

zone “” IN {
type master;
file “”;
allow-update { none; };

if this option is “none” and if the primary master gets off then no any client can update its record. If you are having secondary server then instead of “none” type your secondary server's Ip address.” file   (your zone file)

There are three files in “/var/named” directory, of that “named.local” file is of reverse zone. Copy “” file and paste it at same location with name “”.

Now edit “” file :

a) $TTL 86400 : if any client caches this file then he can cache it for 86400 seconds only. After that he needs to download it from server again.

b) $ORIGIN localhost.

Server's name
i.e. type $ORIGIN    (server's domain name) 

IN SOA@root (
42 ; serial (d.adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS @               (Here IN is 'Internet' NS is 'Name server' & @ is your                                     machine)

  IN A                      (now delete this IN A and)

Make changes as

PRANAY(i.e. your domain name) IN A ipaddress
www IN A ipaddress
 another client IN  A   ipaddress

save & exit

Edit “/etc/hosts” file

only keep there below line, localhost.localdomain localhost

 &    delete all next lines
save & exit
Then start service named i.e.

# service named start
# netconfig

set your ip address & set name server ip address i.e. dns server address

# service network restart

To check it type,
# ping
It will ping the site.

To check whether server is ok & service is ok give command,

# nslookup
# dig

Edit “/var/named/” file

make changes as

IN SOA . root


  IN NS     (server's ip adress)

$ORIGIN                 (i.e. name of your zone)

save & exit

Then Give Command :

# dig


# ping

Check the entries in “/etc/hosts” file
# vim /etc/httpd/conf/httpd.conf

Make changes as

NameVirtualHost (ip address of server):80

Then changs as


then change as

ServerName (ip address of server):80

save & Exit

# service httpd restart


Goto XP's My Network places properties → local area connection properties → TCP-IP properties → Give DNS server IP address → ok

goto run
 ping   (server's Ip address)  

it will show IP address.

1) If you want to create a new zone then copy file “/etc/named/” to the same location with your zone name. i.e.
2) Edit file “/etc/httpd/conf/httpd.conf” and make changes as given above
3) Edit “” file and make changes as given above
4) edit “/etc/named.conf” and make changes as given above
5) restart services named and httpd

Creating Secondary Master

1) Edit “/etc/named.conf

zone “” IN {
type slave ;
file “” ;
  master {(ip address) ;} ;
} ;

If you want to allow your zone to somebody else then,

zone “” IN {
type master ;
file “” ;
allow-update {(ip address of that machine) ;} ;
} ;

save & exit

Now Edit “/etc/rndc.key” file
This file contains security key. This security key is unique for each computer. We need to generate & specify this key for each computer.

Edit “/etc/rndc.conf” file

make change at the end of this file as :

server (ip address)   {
key “redhat” ;
} ;

include “/etc/rndc.key” ;

save & exit


edit “/etc/named.conf ” file

add # to lines with key word “control” and also to nest 2 lines
add # to last line with ley word “include”

save & exit

No comments:

Post a Comment