Anvar Freelance Web Designer and SEO Expert Logo
01 / 01
WhatsApp Logo +91 808 999 0405

DNS Configuration in Linux

DNS (Domain Naming Service)
DNS is a service which is used to resolve host to IP address and zone records & configuration files.
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

#yum install bind-* caching-nameserver*-y
#service named start
#chkconfig named on
#cd /var/named/chroot/etc
#cp named-caching-nameserver named.conf
#vi named.conf
delete ipv6 lines (line nos. 16 &22)
(line no15) Listen on port 53 {;;}
(here is server ip
(line no 21) allow-query (clients range)
(line no 30) match-clients {local host;; } (here is clients ip range & subnet mask)
(line no 31) match-destinations    {localhost;;}


# vi /etc/rfc1912.zones
copy ten lines from 21 to 31 and paste under 31
change as follows
zone "" 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 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 redhat.for
#cp named.local redhat.rev
# vi redhat.for

change as follows

$TTL    86400
@               IN SOA (
42              ; serial (d. adams)
3H              ; refresh
15M             ; retry
1W              ; expiry
1D )            ; minimum
IN NS              IN A             IN CNAME           IN A                IN CNAME          IN A               IN CNAME              IN CNAME              IN CNAME        IN A             IN CNAME        IN A             IN CNAME        IN A             IN CNAME            IN A                  IN CNAME

(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  (
1997022700 ; Serial
28800      ; Refresh
14400      ; Retry
3600000    ; Expire
86400 )    ; Minimum
IN        NS
254      IN       PTR
1         IN       PTR
2        IN       PTR
3         IN      PTR
4         IN      PTR
5         IN      PTR
6         IN      PTR

save & quit

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

to check:

#dig -x
(if answer is 1 server is ready if answer is 0 server has some error)

to check error in configuration file

#named-checkconf /var/named/chroot/etc/named.conf

to check errors in zone record

#named-checkzone /var/named/chroot/var/named/redhat.for
#named-checkzone /var/named/chroot/var/named/redhat.rev

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

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

(change as follows)
copy 10 lines from 21 to 31 paste under 31

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

save& quit

#service named restart

go to client
#i /etc/resolv.conf

nameserver (slave dns ip)

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
in master dns server

# vi /var/named/chroot/etc/named.conf

add aline

forwarders {};
forward only ;

(here is trusted companies dns)
save & quit

#service named restart
by anvar
Published : Mar , 4

Post a comment

Your email address will not be published. Required fields are marked *