scan-dns配置

fei890910發表於2016-04-14
[root@node2 Server]# yum install bind bind-chroot caching-nameserver
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
base                                                                                           | 1.3 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind.i386 30:9.3.6-4.P1.el5_4.2 set to be updated
---> Package bind-chroot.i386 30:9.3.6-4.P1.el5_4.2 set to be updated
---> Package caching-nameserver.i386 30:9.3.6-4.P1.el5_4.2 set to be updated
--> Finished Dependency Resolution


Dependencies Resolved


======================================================================================================================
 Package                           Arch                Version                              Repository           Size
======================================================================================================================
Installing:
 bind                              i386                30:9.3.6-4.P1.el5_4.2                base                978 k
 bind-chroot                       i386                30:9.3.6-4.P1.el5_4.2                base                 44 k
 caching-nameserver                i386                30:9.3.6-4.P1.el5_4.2                base                 61 k


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


Total download size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
----------------------------------------------------------------------------------------------------------------------
Total                                                                                 419 MB/s | 1.1 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : bind                                                                                           1/3 
  Installing     : bind-chroot                                                                                    2/3 
  Installing     : caching-nameserver                                                                             3/3 


Installed:
  bind.i386 30:9.3.6-4.P1.el5_4.2                               bind-chroot.i386 30:9.3.6-4.P1.el5_4.2                
  caching-nameserver.i386 30:9.3.6-4.P1.el5_4.2                


Complete!
[root@node2 Server]# 
[root@node2 Server]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:70:1D:15  
          inet addr:192.168.10.11  Bcast:192.168.6.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe70:1d15/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:70967 errors:0 dropped:0 overruns:0 frame:0
          TX packets:77043 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6903509 (6.5 MiB)  TX bytes:63752378 (60.7 MiB)


eth1      Link encap:Ethernet  HWaddr 08:00:27:60:EE:A3  
          inet addr:192.168.56.102  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe60:eea3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:38111 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2439 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4738076 (4.5 MiB)  TX bytes:447581 (437.0 KiB)


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:1389 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1389 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3179387 (3.0 MiB)  TX bytes:3179387 (3.0 MiB)


sit0      Link encap:IPv6-in-IPv4  
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)


[root@node2 Server]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Kernel \r on an \m


[root@node2 Server]# 
[root@node2 Server]# 
[root@node2 Server]# 




[root@node2 Server]# cd /var/named/chroot/etc
[root@node2 etc]# ls
localtime  named.caching-nameserver.conf  named.rfc1912.zones  rndc.key
[root@node2 etc]# ls -l
total 16
-rw-r--r-- 1 root root   405 Feb 22  2013 localtime
-rw-r----- 1 root named 1230 Jan 18  2010 named.caching-nameserver.conf
-rw-r----- 1 root named  955 Jan 18  2010 named.rfc1912.zones
-rw-r----- 1 root named  113 Mar 28 16:27 rndc.key
[root@node2 etc]# 


二、生成配置named.conf
127.0.0.1 改成any
localhost 改成any
[root@node2 etc]# cp -p named.caching-nameserver.conf named.conf
[root@node2 etc]# pwd
/var/named/chroot/etc
[root@node2 etc]# vi named.conf
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver 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.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
        listen-on port 53 { any; };
        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";


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


        allow-query     { any; };
        allow-query-cache { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};
~


~
"named.conf" 41L, 1200C written
[root@node2 etc]# 
[root@node2 etc]# 
[root@node2 etc]# 
[root@node2 etc]# ll
total 20
-rw-r--r-- 1 root root   405 Feb 22  2013 localtime
-rw-r----- 1 root named 1230 Jan 18  2010 named.caching-nameserver.conf
-rw-r----- 1 root named 1200 Mar 28 16:32 named.conf
-rw-r----- 1 root named  955 Jan 18  2010 named.rfc1912.zones
-rw-r----- 1 root named  113 Mar 28 16:27 rndc.key
[root@node2 etc]# named.conf


三、建立域
[root@node2 etc]# vi /var/named/chroot/etc/named.rfc1912.zones 
zone "10.168.192.in-addr.arpa" IN {
        type master;
        file "10.168.192.in-addr.arpa";
        allow-update { none; };
};








[root@node2 etc]# cd /var/named/chroot/var/named/
[root@node2 named]# ll
total 36
drwxrwx--- 2 named named 4096 Aug 26  2004 data
-rw-r----- 1 root  named  198 Jan 18  2010 localdomain.zone
-rw-r----- 1 root  named  195 Jan 18  2010 localhost.zone
-rw-r----- 1 root  named  427 Jan 18  2010 named.broadcast
-rw-r----- 1 root  named 1892 Jan 18  2010 named.ca
-rw-r----- 1 root  named  424 Jan 18  2010 named.ip6.local
-rw-r----- 1 root  named  426 Jan 18  2010 named.local
-rw-r----- 1 root  named  427 Jan 18  2010 named.zero
drwxrwx--- 2 named named 4096 Jul 27  2004 slaves
[root@node2 named]# cp -p named.local 10.168.192.in-addr.arpa
[root@node2 named]# ll
total 40
-rw-r----- 1 root  named  426 Jan 18  2010 10.168.192.in-addr.arpa
drwxrwx--- 2 named named 4096 Aug 26  2004 data
-rw-r----- 1 root  named  198 Jan 18  2010 localdomain.zone
-rw-r----- 1 root  named  195 Jan 18  2010 localhost.zone
-rw-r----- 1 root  named  427 Jan 18  2010 named.broadcast
-rw-r----- 1 root  named 1892 Jan 18  2010 named.ca
-rw-r----- 1 root  named  424 Jan 18  2010 named.ip6.local
-rw-r----- 1 root  named  426 Jan 18  2010 named.local
-rw-r----- 1 root  named  427 Jan 18  2010 named.zero
drwxrwx--- 2 named named 4096 Jul 27  2004 slaves




配置正向解析資料檔案
[root@node2 named]# vi localdomain.zone
$TTL    86400
@               IN SOA  localhost root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           localhost
localhost       IN A            127.0.0.1


scan-cluster           IN A 192.168.10.20
                       IN A 192.168.10.21
                       IN A 192.168.10.22
~






配置反向解析資料檔案
[root@node2 named]# vi 10.168.192.in-addr.arpa
$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      localhost.
1       IN      PTR     localhost.




20      IN    PTR    scan-cluster.localdomin
21      IN    PTR    scan-cluster.localdomin
22      IN    PTR    scan-cluster.localdomin




[root@node2 named]# /etc/init.d/named status
rndc: connect failed: 127.0.0.1#953: connection refused
named is stopped
[root@node2 named]# /etc/init.d/named start
Starting named: [  OK  ]
[root@node2 named]# 
[root@node2 named]# 
[root@node2 named]# /etc/init.d/named status
number of zones: 7
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/1000
tcp clients: 0/100
server is up and running
named (pid  21662) is running...
[root@node2 named]# 


四、節點一配置
[root@node2 named]# vi /etc/resolv.conf
search     localdomain
nameserver 192.168.10.11




[root@node2 named]# nslookup 192.168.10.22
Server:         192.168.10.11
Address:        192.168.10.11#53


22.10.168.192.in-addr.arpa      name = scan-cluster.localdomin.10.168.192.in-addr.arpa.


[root@node2 named]# nslookup scan-cluster
Server:         192.168.10.11
Address:        192.168.10.11#53


Name:   scan-cluster.localdomain
Address: 192.168.10.21
Name:   scan-cluster.localdomain
Address: 192.168.10.22
Name:   scan-cluster.localdomain
Address: 192.168.10.20


[root@node2 named]# 



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29108064/viewspace-2080970/,如需轉載,請註明出處,否則將追究法律責任。