Prakash Sawarkar: Kernel 3.8 Released, how to Compile in Redhat, CenOS and Fedora..

Kernel 3.8 Released, how to Compile in Redhat, CentOS and Fedora.

Monday, 28 September 2009

DNS Configuration in CentOS /Redhat

DNS is a service which is used to resolve host to IP address and zone records & configuration files.

MASTER DNS

There are two types of zonerecords
1) Forwad lookup zone
2) Reverse lookup zone

 By defaults, computer connects to another computer with the help of IP address


Forward lookup zone :  It converts names into IP addresses

Reverse lookup zone: It converts IP addresses to names
Steps:
# yum install bind-* caching-nameserver*-y
# service named start
# chkconfig named on
# cd /var/named/chroot/etc
# ls
# cp named-caching-nameserver named.conf
# vi named.conf
  delete ipv6 lines (line nos. 16 &22)

(line no15) Listen on port 53 {127.0.0.1; 192.168.0.254;}
(here 192.168.0.254 is server ip
(line no 21) allow-query  192.168.0.0/24 (clients range)
(line no 30) match-clients {local host; 192.168.0.0/24; } (here 192.168.0.0/24 is clients ip range & subnet mask)
(line no 31) match-destinations    {localhost; 192.168.0.0/24;}
save&quit

#  vi /etc/rfc1912.zones
 copy ten lines from 21 to 31 and paste under 31
 change as follows
 zone "redhat.com" IN { 
  type master;
  file "redhat.for"
   allow-update { none; };
};
zone "0.168.192.IN-addr-arpa IN {
   type master;
   file "redhat.rev"
    allow-update { none; };
};

(here redhat.com is domain name and 0.168.192. is redhat.coms network range redhat.for is forward look up zone & redhat.rev is reverse lookup zone)
save & quit
#  chgrp named named.conf
# chgrp named named.rfc1912.zones
# cd /var/named/chroot/var/named
# cp localhost.zone redhat.for
# cp named.local redhat.rev
#  vi redhat.for

change as follows
$TTL    86400
@               IN SOA  redhat.com.       root.redhat.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           server1.redhat.com.
server1.redhat.com.             IN A            192.168.0.254
www254.redhat.com.           IN CNAME        server1.redhat.com.
station1.redhat.com.           IN A            192.168.0.1
www1.redhat.com.              IN CNAME        station1.redhat.com.
station2.redhat.com.          IN A            192.168.0.2
www2.redhat.com.             IN CNAME        station2.redhat.com.
xxx2.redhat.com.              IN CNAME        station2.redhat.com.
yyy2.redhat.com.              IN CNAME        station2.redhat.com.
station3.redhat.com.        IN A            192.168.0.3
www3.redhat.com.           IN CNAME        station3.redhat.com.
station4.redhat.com.        IN A            192.168.0.4
www4.redhat.com.           IN CNAME        station4.redhat.com.
station5.redhat.com.        IN A            192.168.0.5
www5.redhat.com.           IN CNAME        station5.redhat.com.
station6.redhat.com.            IN A            192.168.0.6
www6.redhat.com.                IN CNAME        station6.redhat.com.



(zone: zone is a storage database which contains all zone records

forward lookup zone: used for resolving hostname to ipaddress & it maintains host to ip mapping information
reverse lookup zone: used for resolving ip address to hostname & it maintains ip to hostname mapping information

Types of records: 
SOA : sort of authority the first record in any zone  it indicates who is authority for this domain
NS :nameserver it identifies the dns server for each zone
A record : resolves hostname to ip address
CNAME record : resolves an alias name to a hostname
PTR record : resolves an ipaddress to a hostname
MX record : resolves mail server ip (used by mail server)
TTL :time to live)

save & quit

# vi redhat.rev
(change as follows)
$TTL    86400
@       IN      SOA redhat.com.    root.redhat.com.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                     86400 )    ; Minimum
            IN        NS      server1.redhat.com.
254      IN       PTR     server1.redhat.com.
1         IN       PTR     station1.redhat.com.
2        IN       PTR      station2.redhat.com.
3         IN      PTR     station3.redhat.com.
4         IN      PTR     station4.redhat.com.
5         IN      PTR     station5.redhat.com.
6         IN      PTR   station6.redhat.com.

save & quit

#  chgrp named redhat.for
#  chgrp named redhat.rev
#  service named restart

 to check:
# dig server1.redhat.com
# dig -x 192.168.0.1
 (if answer is 1 server is ready if answer is 0 server has some error)

to check error in configuration file
# named-checkconf redhat.com /var/named/chroot/etc/named.conf

to check errors in zone record 
# named-checkzone redhat.com /var/named/chroot/var/named/redhat.for
# named-checkzone redhat.com /var/named/chroot/var/named/redhat.rev

 SLAVE DNS

 Master DNS Server
It is the Master Copy of all the Zone Information.
It is Read/Write copy.

Slave DNS Server
It is Slave Backup of Master zone. It is Read Only

        if any error may occur to your dns server at the time the entir network will stop.sometimes it may cause huge damage.for that one we are createing slave dns for faulttolerance and load balancing.

we need another system which contains server o/s

Steps:

# yum install bind-* caching-nameserver -y
# service named start
# chkconfig named on
# cd /var/named/chroot/etc/named-rfc1912.zone

(change as follows)
copy 10 lines from 21 to 31 paste under 31
zone "redhat.com"
  type slave;
  file "redhat.for"
  masters {192.168.0.254:};

zone "0.168.192. IN-ADDR-arpa" IN {
  type slave ;
  file " redhat.rev"
  masters {192.168.0.254;};

save& quit

#service named restart
go to client 
# vi /etc/resolv.conf

nameserver 192.168.0.254
nameserver 192.168.0.1 (slave dns ip)  

FORWARDERS

If you have trusted relationship with another company  those comapny users can enter into our network & our company users can enter into their network by using this forwarders
Steps:
in master dns server 
#  vi /var/named/chroot/etc/named.conf

add aline 
 forwarders {192.168.10.254:};
 forward only ;
};
(here 192.168.10.254 is trusted companies dns)
save & quit

# service named restart