Monday, 24 November 2014

HOW TO CONFIGURE DNS IN LINUX/REDHAT 6/CENTOS 6


                                                                  How to configure DNS

What is DNS?
Domain Name System
The Domain Name System (DNS) is the crucial glue that keeps computer networks in harmony by converting human-friendly hostnames to the numerical IP addresses computers require to communicate with each other. DNS is one of the largest and most important distributed databases the world depends on by serving billions of DNS requests daily for public IP addresses. Most public DNS servers today are run by larger ISPs and commercial companies but private DNS servers can also be useful for private home networks.


Hostname: station.example.com
IP Address : 192.168.194.171



First check the IP:








To Set DNS Server IP

[root@station ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Note:  Please write ip  address of DNS server  in this file.





To Set Hostname

Note: Please write the hostname in below files.

[root@station ~]# hostname station.example.com


[root@station ~]# vi /etc/sysconfig/network

[root@station ~]# vi /etc/hosts









To Install Package



To Change directory


To create configuration file




To Change Group Name


To Copy File same Location



To change directory


To edit configuration file

[root@station named]# cat for.zone
$TTL 1D
@       IN SOA  example.com. root.example.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
@       IN      NS      station.example.com.
station IN      A       192.168.194.171
[root@station named]#


[root@station named]# cat rev.zone
$TTL 1D
@       IN SOA  example.com. root.example.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
@       IN      NS      station.example.com.
171       IN      PTR   station.example.com.


[root@station named]#





To Change Group Name


[root@station named]# chgrp named for.zone
[root@station named]# chgrp named rev.zone

To Restart Service & On

[root@station ~]#
[root@station ~]# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
[root@station ~]#
[root@station ~]# chkconfig named on
[root@station ~]#


To Check Named Server



[root@station ~]#
[root@station ~]# dig 192.168.194.171

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> 192.168.194.171
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 15040
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;192.168.194.171.               IN      A

;; AUTHORITY SECTION:
.                       10800   IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2014112400 1800 900 604800 86400

;; Query time: 308 msec
;; SERVER: 192.168.194.171#53(192.168.194.171)
;; WHEN: Mon Nov 24 20:43:23 2014
;; MSG SIZE  rcvd: 108

[root@station ~]#

[root@station ~]#
[root@station ~]# dig station.example.com

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> station.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49533
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;station.example.com.           IN      A

;; ANSWER SECTION:
station.example.com.    86400   IN      A       192.168.194.171

;; AUTHORITY SECTION:
example.com.            86400   IN      NS      station.example.com.

;; Query time: 0 msec
;; SERVER: 192.168.194.171#53(192.168.194.171)
;; WHEN: Mon Nov 24 20:43:55 2014
;; MSG SIZE  rcvd: 67


[root@station ~]#
[root@station ~]# nslookup 192.168.194.171
Server:         192.168.194.171
Address:        192.168.194.171#53

171.194.168.192.in-addr.arpa    name = station.example.com.

[root@station ~]#

[root@station ~]#
[root@station ~]# nslookup station.example.com
Server:         192.168.194.171
Address:        192.168.194.171#53

Name:   station.example.com
Address: 192.168.194.171

[root@station ~]#

Client end setting:

Please write IP address of DNS server in /etc/resolv.conf

[root@station2 ~]#
[root@station2 ~]# cat /etc/resolv.conf
search station.example.com
nameserver 192.168.194.171
[root@station2 ~]#

[root@station2 ~]#
[root@station2 ~]#
[root@station2 ~]# dig 192.168.194.171

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> 192.168.194.171
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 62190
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;192.168.194.171.               IN      A

;; AUTHORITY SECTION:
.                       10490   IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2014112400 1800 900 604800 86400

;; Query time: 1 msec
;; SERVER: 192.168.194.171#53(192.168.194.171)
;; WHEN: Mon Nov 24 20:48:34 2014
;; MSG SIZE  rcvd: 108

[root@station2 ~]# dig station.example.com

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> station.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56694
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;station.example.com.           IN      A

;; ANSWER SECTION:
station.example.com.    86400   IN      A       192.168.194.171

;; AUTHORITY SECTION:
example.com.            86400   IN      NS      station.example.com.

;; Query time: 1 msec
;; SERVER: 192.168.194.171#53(192.168.194.171)
;; WHEN: Mon Nov 24 20:48:55 2014
;; MSG SIZE  rcvd: 67

[root@station2 ~]#






No comments:

Post a Comment