Wednesday, August 24, 2016

DNS Configuration


1 configuring DNS server:-
[root@puppet ~]# yum install bind* caching-nameserver

2. check some configuration file:-
[root@puppet ~]# vim /etc/sysconfig/network
HOSTNAME=puppet.example.com

2 check /etc/hosts
[root@puppet ~]#vim /etc/hosts
192.168.100.100 puppet.example.com puppet

3 .now configure DNS
[root@puppet ~]# cd /var/named/chroot/etc/
[root@puppet etc]# ll
total 20
-rw-r--r-- 1 root root 265 Dec 22 14:31 localtime
-rw-r----- 1 root named 1230 Jan 18 2010 named.caching-nameserver.conf
-rw-r----- 1 root named 1162 Dec 24 04:10 named.conf
-rw-r----- 1 root named 955 Jan 18 2010 named.rfc1912.zones
-rw-r----- 1 root named 113 Dec 24 03:51 rndc.key

[root@puppet etc]# cp named.caching-nameserver.conf named.conf
[root@puppet etc]# vim named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.100.100; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";

// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;

allow-query { localhost; any; };
allow-query-cache { localhost; };
};
zone "example.com" IN {
type master;
file "for.zone";
allow-update { none; };
};

zone "100.168.192.in-addr.arpa" IN {
type master;
file "rev.zone";
allow-update { none; };
};

create zone:-
[root@puppet ~]# cd /var/named/chroot/var/named
[root@puppet named]# cp localdomain.zone for.zone
[root@puppet named]# cp -p named.local rev.zone
[root@puppet named]# vim for.zone
$TTL 86400
@ IN SOA puppet.example.com. root.puppet.example.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS puppet.example.com.
puppet IN A 192.168.100.100
shekhar IN A 192.168.100.99


[root@puppet named]# vim rev.zone
$TTL 86400
@ IN SOA puppet.example.com. root.puppet.example.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS puppet.example.com.
100 IN PTR puppet.example.com.


Restart DNS Sertver:-
[root@puppet named]# /etc/init.d/named restart

Now check if your DNS working properly:-
[root@puppet named]# dig -x 192.168.100.100

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> -x 192.168.100.100
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39336
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;100.100.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION:
100.100.168.192.in-addr.arpa. 86400 IN PTR puppet.example.com.

;; AUTHORITY SECTION:
100.168.192.in-addr.arpa. 86400 IN NS puppet.example.com.

;; ADDITIONAL SECTION:
puppet.example.com. 86400 IN A 192.168.100.100

;; Query time: 22 msec
;; SERVER: 192.168.100.100#53(192.168.100.100)
;; WHEN: Mon Dec 24 22:05:12 2012
;; MSG SIZE rcvd: 108


[root@puppet named]# dig puppet.example.com

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> puppet.example.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2597
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

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

;; ANSWER SECTION:
puppet.example.com. 86400 IN A 192.168.100.100

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

;; Query time: 1 msec
;; SERVER: 192.168.100.100#53(192.168.100.100)
;; WHEN: Mon Dec 24 22:06:19 2012
;; MSG SIZE rcvd: 66

No comments:

Post a Comment