========How to configure DNS in Rhel6.4=============
[root@master ~]# yum install bind*
[root@master ~]# cp -p /etc/named.* /var/named/chroot/etc/
[root@master ~]# rm -rf /etc/named.*
[root@master ~]# cp -p /var/named/named.* /var/named/chroot/var/named/
[root@master ~]# rm -rf /var/named/named.*
[root@master ~]# cd /var/named/chroot/etc/
[root@master etc]# ll
total 28
-rw-r--r-- 1 root root 265 Jan 8 21:35 localtime
drwxr-x--- 2 root named 4096 Dec 5 2012 named
-rw-r----- 1 root named 1008 Jul 19 2010 named.conf
-rw-r--r-- 1 root named 2389 Dec 5 2012 named.iscdlv.key
-rw-r----- 1 root named 931 Jun 21 2007 named.rfc1912.zones
-rw-r--r-- 1 root named 487 Jul 19 2010 named.root.key
drwxr-x--- 3 root named 4096 Jan 8 21:35 pki
[root@master etc]# cat named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { 127.0.0.1;192.168.122.132; };
listen-on-v6 port 53 { ::1; };
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";
allow-query { localhost; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
zone "example.com" IN {
type master;
file "tom";
allow-update { none; };
};
zone "122.168.192.in-addr.arpa" IN {
type master;
file "jerry";
allow-update { none; };
};
[root@master ~]# cd /var/named/chroot/var/named/
[root@master named]# cp -p named.localhost tom
[root@master named]# cat tom
$TTL 1D
@ IN SOA master.example.com. root.master.example.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS master.example.com.
master A 192.168.122.132
[root@master named]# cp -p named.empty jerry
[root@master named]# cat jerry
$TTL 3H
@ IN SOA master.example.com. root.master.example.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS master.example.com.
132 PTR master.
[root@master named]# /etc/init.d/named start
Generating /etc/rndc.key: [ OK ]
Starting named: [ OK ]
[root@master ~]# nslookup master.example.com (FQDN)
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: master.example.com
Address: 192.168.122.132
[root@master ~]# dig master.example.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> master.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23023
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;master.example.com. IN A
;; ANSWER SECTION:
master.example.com. 86400 IN A 192.168.122.132
;; AUTHORITY SECTION:
example.com. 86400 IN NS master.example.com.
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jan 8 21:52:46 2014
;; MSG SIZE rcvd: 66
[root@master ~]# dig -x 192.168.122.132
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> -x 192.168.122.132
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35520
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;132.122.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
132.122.168.192.in-addr.arpa. 10800 IN PTR master.
;; AUTHORITY SECTION:
122.168.192.in-addr.arpa. 10800 IN NS master.example.com.
;; ADDITIONAL SECTION:
master.example.com. 86400 IN A 192.168.122.132
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jan 8 21:53:02 2014
;; MSG SIZE rcvd: 114
No comments:
Post a Comment