Posted by: Mangesh_Linux_Administrator | September 3, 2010

Basic concept/configuration of DNS (very imp)


DNS SERVER

DNS –Domain Name System Server
SERVICES  : SYSTEM  V
PORT  NO. :    53
package   : bind, caching-nameserver, bind-chroot

Config file: /etc/named.conf         or
/var/named/chroot/etc/named.conf  (if chroot installed)

Zones files are under:  /var/named/   or
/var/named/chroot/var/named  (if chroot installed)

Features :-
1)  forward lookup –  converts hostname to IP address
2)  reverse lookup – converts IP address to hostname
3)  MX records –     mail exchanger Mail exchanger records kept inside the DNS
4)    Zone  :-  zone is a set of record of every machine in domain

•    TWO TYPES OF DNS SERVER

1] MASTER  DNS : –  master DNS  consist of main copy of zone deta
2] SLAVE  DNS  :-  replicated copy of Master DNS

•    Advantages of Master & Slave DNS
1] fault tolerance :- if master DNS server is down then we can make use of slave DNS.
2] Load Balancing:- management of client by both.
———————————————————————————————————-

How to configure main config file    (Basic setup)

#vi  /var/named/chroot/etc/named.conf
=> Add these lines

Options {
directory  “/var/named”;
};

zone   “example.com”  IN {
type master;
file  “example.com.zone”;
};
zone  “0.168.192.in-addr.arpa” IN {
type master;
file  “192.168.0.zone”;
};

Explanation :–

Line —  1) option for the zone
{ start of options
2) directory from which the zones are to be taken
3) End of option
4) start of forward lookup zone for example.com
IN – internet
{ start of zone
5) type master – type of DNS is master DNS
6) name of forward lookup zone
7) }; end of forward lookup zone
8) this is revers lookup zone for example.com
in-addr.arpa  = syntax of DNS
IN- internet   { start of reverse lookup zone
9) type of DNS  is master DNS
10) name of reverse lookup zone
11) }; end of reverse lookup zone

—————————————————————————————————————

# cd  /var/named/shroot/var/named/

for forward lookup zone

# vi  example.com.zone

$TTL   86400
example.com            IN    SOA    station1.example.com.    root.station1.example.com. (
42        ; Serial
3H         ; Refresh
15M        ; Retry
1W        ; Expiry
1D )        ; Negative answer cache

IN    NS    station1.example.com.

Station1           IN     A         192.168.0.1
Station2           IN    A         192.168.0.2
Station3           IN    A            192.168.0.3
Station4               IN    A         192.168.0.4

@               IN    MX  10      server1
@                IN    MX  20        station1

www1                  IN    CNAME         station1
www2                  IN        CNAME         station2
www3                  IN        CNAME         station3
www4                  IN        CNAME         station4

Explanation  :–
1)$ TTL  :– time to live ? time to live cache
Memory? the client will stored the
Answer got from DNS server for ( 86400)
This mili second
2) example.com  = name of the zone
IN   = internet
SOA  = start of authority
Station1.example.com ? host name of DNS
Root.station1.example.com?  Administrator of DNS server is root user
(  = start of option
3) 42 = serial version number means  — IF  any change i.e addition of removal of
Machine the next version is 2 be given.
4) 3H ; Refresh ;  = the slave DNS then it will replicated deta from master DNS
Every 3 hourse.
5) 15m; retry = the slave  DNS is enable to contact master DNS  then it will
Keeping after every 15 min .
6) 1W; Expire ? means if slave server is not able to contact the master for 1 week
then it is no use
7) 1D ) = if client has not got the answer from master of DNS server for a particular
host machine then it will not contact DNS for 1 day for that host.
8) IN – internet  NS  = name server is station 2.example.com

18)  @  = example.com
19)  MX = mail exchanger
20)  MX = 10 & 20 – priority  of mail exchange
21)  CNAME = CANONICAL NAME  for www1  is station1

———————————————————————————————————————-

For reverse zone

#  vi   192.168.0.zone
$TTL   86400
@          IN          SOA     station1.example.com    root@station1.example.com  (
(
42          ; Serial
3H              ; Refresh
15M           ; Retry
1W          ; Expiry
1 D  )        ; minimum
IN            NS         station1.example.com
1.0.168.192.in-addr.arpa            IN        PTR          station1.example.com.
2.0.168.192.in-addr.arpa            IN        PTR          station2.example.com.
3.0.168.192.in-addr.arpa            IN        PTR          station3.example.com.
4.0.168.192.in-addr.arpa            IN        PTR          station4.example.com.

Explanation:
line of 1.0.168.192.in-addr.arpa  reveres lookup add for station 1  in-addr.arpa = syntax of DNS
PTR – pointer
Station1.example.com  — HOSTNAME
————————————————————————————————————————–

Entry of DNS RESOLVERS
#   vi   /etc/resolve.conf
make entry as
Search   example.com
Nameserver 192.168.0.1   (IP of DNS server)

————————————————————————————————————————-
START DNS SERVER

# /etc/init.d/named configtest  (check syntax)
# service named restart
————————————————————————————————————————-
Verify DNS SERVER

#  host -l example.com  => It gives you list of domains

#  host station2.example.com  =>  It gives u IP address
#  host   192.168.0.4      =>      gives you hostname

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Categories

%d bloggers like this: