Centos DNS配置

2101阅读 2评论2011-01-11 tonecan2008
分类:LINUX

环境 虚拟机+Centos5.5+bind9.3.6 虚拟机IP 192.168.1.150
 
一 BIND组件的安装
 
[root@tonecan ~]# yum -y install bind*
[root@tonecan ~]# yum -y install caching-nameserver*
 
 
二 BIND的配置
[root@tonecan ~]# cd /var/named/chroot/etc/
[root@tonecan etc]# ls -la
总计 72
drwxr-x--- 2 root named 4096 01-11 21:58 .
drwxr-x--- 6 root named 4096 01-11 19:04 ..
-rw-r--r-- 1 root root  1333 01-11 19:00 ]
-rw-r--r-- 1 root root   405 01-11 18:17 localtime
-rw-r----- 1 root named 1230 12-14 02:10 named.caching-nameserver.conf
-rw-r----- 1 root named 1188 01-11 20:24 named.rfc1912.zones
-rw-r----- 1 root named  113 01-11 18:55 rndc.key
[root@tonecan etc]# cp -p named.caching-nameserver.conf named.conf
[root@tonecan etc]# vim 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";
};

 
[root@tonecan etc]# cp named.rfc1912.zones -p named.rfc1912.zones.bak
[root@tonecan etc]# vim named.rfc1912.zones
 
 

// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
        type hint;
        file "named.ca";
};

zone "localdomain" IN {
        type master;
        file "localdomain.zone";
        allow-update { none; };
};

zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.ip6.local";
        allow-update { none; };
};

zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
};

zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
};

zone "seakv.com" IN {
        type master;
        file "seakv.com.zone";
        allow-update { none; };
};

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

 
配置中引用了两个新的文件:seakv.com.zone和192.168.1.zone
 
[root@tonecan etc]# cd /var/named/chroot/var/named/
[root@tonecan named]# ls -al
总计 104
drwxr-x--- 4 root  named 4096 01-11 22:00 .
drwxr-x--- 6 root  named 4096 01-11 18:55 ..
drwxrwx--- 2 named named 4096 01-11 19:47 data
-rw-r----- 1 root  named  198 12-14 02:10 localdomain.zone
-rw-r----- 1 root  named  195 12-14 02:10 localhost.zone
-rw-r----- 1 root  named  427 12-14 02:10 named.broadcast
-rw-r----- 1 root  named 1892 12-14 02:10 named.ca
-rw-r----- 1 root  named  424 12-14 02:10 named.ip6.local
-rw-r----- 1 root  named  426 12-14 02:10 named.local
-rw-r----- 1 root  named  427 12-14 02:10 named.zero
drwxrwx--- 2 named named 4096 2004-07-27 slaves
 
[root@tonecan named]# cp -p localdomain.zone seakv.com.zone
[root@tonecan named]# cp -p named.local 192.168.1.zone
[root@tonecan named]# vim 192.168.1.zone
 
 
$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
          IN      NS      localhost.
1        IN      PTR     localhost.
150     IN      PTR    
[root@tonecan named]# vim seakv.com.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
www             IN A            192.168.1.150
bbs              IN A            192.168.1.150
~

[root@tonecan named]# /etc/init.d/named restart   (service named restart)
停止 named:                                               [确定]
启动 named:                                               [确定]
[root@tonecan named]# chkconfig --level 345 named on  (开机启动bind服务)
 

二 结果测试
 
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>nslookup
Default Server: 
Address:  192.168.1.150
 
本文参照: http://home.pomoho.com/hzxiest/blogview/3906153

 
上一篇:Centos安装vim
下一篇:CentOS配置DHCP服务器

文章评论