CENTOS下配置DNS

edwardking888發表於2011-02-10
第一步 安裝bind
rpm -qa bind* 
想省事可以直接yum -y install bind*,還有一個一定要安裝的是 yum -y install caching-nameserver,不然不能做後面的配置工作。bing 預設是安裝在/var/named/chroot/下面。
首先要配置的是name.conf,
進入etc目錄下
用命令cp -p named.caching-nameserver.conf  named.conf 引數-p的作用是把許可權也一起復制
修改後的檔案為:
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";
};
 
第二步,配置zone
在named.rfc1912.zones檔案下新增幾行:
zone "dba11g.cn" IN {
type master;
file "dba11g.zone";
};
zone "75.168.192.in-addr.arpa" IN {
type master;
file "192.168.75.local";
};
進入/var/named/chroot/var/named目錄
新增192.168.75.local和dba11g.zone檔案:
192.168.75.local內容如下:
$ttl 600
@ IN SOA master.dba11g.cn. root.dba11g.cn.(
1997022700 ; Serial
600 ; Refresh
120 ; Retry
600 ; Expire
600 ) ; Negative Cache TTL
   IN NS master.dba11g.cn.
   IN MX 5 dba11g.cn.
rac1  IN A 192.168.75.42
rac2  IN A 192.168.75.43
rac1-vip IN A 192.168.75.45
rac2-vip IN A 192.168.75.47
rac1-priv IN A 192.168.75.46
rac1-priv IN A 192.168.75.48
scan  IN A 192.168.75.50
   
 dba11g.zone檔案內容如下:
$TTL 600
@ IN SOA master.dba11g.cn. root.dba11g.cn.(
1997022700;
600;
120;
600;
600 );
@ IN NS master.dba11g.cn.
65 IN PTR scan.dba11g.com.
 
 
然後啟動
# service named start
啟動 named:[確定]
 

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

相關文章