Tuesday, July 9, 2013

Configure Primary DNS Server in redhat 6 Step by Step

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. This article will explo

To Check IP
[root@www Desktop]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:84:6D:8C 
          inet addr:10.90.12.1  Bcast:10.90.12.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe84:6d8c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6624 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1474 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:442710 (432.3 KiB)  TX bytes:1901220 (1.8 MiB)
          Interrupt:19 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:0C:29:84:6D:96 
          inet addr:10.23.151.66  Bcast:10.23.159.255  Mask:255.255.224.0
          inet6 addr: fe80::20c:29ff:fe84:6d96/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13927 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7518 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9215651 (8.7 MiB)  TX bytes:948169 (925.9 KiB)
          Interrupt:19 Base address:0x2080

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:480 (480.0 b)  TX bytes:480 (480.0 b)

To Set DNS Server IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0

EVICE=eth0
HWADDR=00:0c:29:84:6d:8c
NM_CONTROLLED=no
ONBOOT=yes
IPADDR=10.90.12.1
BOOTPROTO=none
NETMASK=255.255.255.0
DNS=10.90.12.1
TYPE=Ethernet
IPV6INIT=no
USERCTL=no

save :wq

To Set Host Name
[root@station Desktop]# vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=station.example.com

save :wq

[root@station Desktop]# vim /etc/hosts
0.90.12.1      station.example.com     station

save :wq

[root@station Desktop]# vim /etc/resolv.conf
search station.example.com
nameserver 10.90.12.1

save :wq

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

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

To Install Package
[root@station Desktop]# yum install bind*
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository 'yum' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Setting up Install Process
Package 32:bind-utils-9.7.3-8.P3.el6.i686 already installed and latest version
Package 32:bind-libs-9.7.3-8.P3.el6.i686 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package bind.i686 32:9.7.3-8.P3.el6 will be installed
---> Package bind-chroot.i686 32:9.7.3-8.P3.el6 will be installed
---> Package bind-dyndb-ldap.i686 0:0.2.0-7.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch        Version                    Repository  Size
================================================================================
Installing:
 bind                   i686        32:9.7.3-8.P3.el6          yum        3.9 M
 bind-chroot            i686        32:9.7.3-8.P3.el6          yum         67 k
 bind-dyndb-ldap        i686        0.2.0-7.el6                yum         49 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 4.0 M
Installed size: 7.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): bind-9.7.3-8.P3.el6.i686.rpm                      | 3.9 MB     00:00    
(2/3): bind-chroot-9.7.3-8.P3.el6.i686.rpm               |  67 kB     00:00    
(3/3): bind-dyndb-ldap-0.2.0-7.el6.i686.rpm              |  49 kB     00:00    
--------------------------------------------------------------------------------
Total                                            20 MB/s | 4.0 MB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : 32:bind-9.7.3-8.P3.el6.i686                                  1/3
  Installing : 32:bind-chroot-9.7.3-8.P3.el6.i686                           2/3
  Installing : bind-dyndb-ldap-0.2.0-7.el6.i686                             3/3

Installed:
  bind.i686 32:9.7.3-8.P3.el6            bind-chroot.i686 32:9.7.3-8.P3.el6   
  bind-dyndb-ldap.i686 0:0.2.0-7.el6   

Complete!
[root@station Desktop]#

 To Copy named.conf file
[root@station Desktop]# cp /etc/named.conf  /var/named/chroot/etc/named.conf


To Change directory
 cd /var/named/chroot/etc/

To edit configuration file
[root@station etc]#vim named.conf
options {
        directory       "/var/named";
};

zone "example.com" IN {
        type master;
        file "for.zone";
};

zone "12.90.10.in-addr.arpa" IN {
        type master;
        file "rev.zone";
};

save :wq

To Change Group Name
[root@station etc]# chgrp named named.conf

To Copy File same Location
[root@station etc]# cp /var/named/named.localhost /var/named/chroot/var/named/for.zone
[root@station etc]# cp /var/named/named.loopback /var/named/chroot/var/named/rev.zone

To change directory
[root@station etc]# cd /var/named/chroot/var/named/

To edit configuration file
[root@station named]# vim 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       10.90.12.1

save :wq

To edit configuration file
[root@station named]# vim 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.
1       IN      PTR     station.example.com.

save :wq

To Change Group Name
[root@station named]# chgrp named for.zone
[root@station named]# chgrp named rev.zone
[root@station named]# ll
total 8
-rw-r-----. 1 root named 190 Jun  1 19:12 for.zone
-rw-r-----. 1 root named 196 Jun  1 19:15 rev.zone
[root@station named]#

To Restart Service & On
[root@station named]# service named restart
Stopping named:                                            [  ok  ]
Starting named:                                            [  ok  ]

[root@station named]# chkconfig named on

To Check Named Server
[root@station named]# dig 10.90.12.1

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

;; QUESTION SECTION:
;10.90.12.1.            IN    A

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

;; Query time: 193 msec
;; SERVER: 113.193.1.14#53(113.193.1.14)
;; WHEN: Fri Jun  1 19:17:27 2012
;; MSG SIZE  rcvd: 103

[root@station named]# 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: 24133
;; 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    10.90.12.1

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

;; Query time: 1 msec
;; SERVER: 10.90.12.1#53(10.90.12.1)
;; WHEN: Fri Jun  1 19:17:47 2012
;; MSG SIZE  rcvd: 67

[root@station named]#


Client end Setting



[admin@station1]$vim /etc/resolve.conf

search station.example.com
nameserver 10.90.12.1
Save :wq
[admin@station1]$ 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: 24133
;; 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    10.90.12.1

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

;; Query time: 1 msec
;; SERVER: 10.90.12.1#53(10.90.12.1)
;; WHEN: Fri Jun  1 19:17:47 2012
;; MSG SIZE  rcvd: 67

No comments:

Post a Comment