日期:2014-05-16  浏览次数:20751 次

Linux bind 域名服务器安装配置
系统环境
CentOS 5.5 x64

检查是否安装 BIND

# rpm -qa|grep bind
bind-libs-9.3.6-4.P1.el5_4.2
ypbind-1.19-12.el5
bind-9.3.6-4.P1.el5_4.2
bind-chroot-9.3.6-4.P1.el5_4.2
bind-utils-9.3.6-4.P1.el5_4.2

不然
rpm -ivh /mnt/CentOS/bind-*.rpm

卸载已安装的 bind
rpm -qa | grep '^bind' | while read line
>do                                                                     
>rpm -e --nodeps $line                                  
>done  

检查是否安装 caching-nameserver
# rpm -qa|grep caching-nameserver
不然就安装
/mnt/CentOS/caching-nameserver*.rpm
卸载已安装的 caching-nameserver
rpm -e caching-nameserver --nodeps

完成安装后,

配置本机ip和dns

本机ip:   192.168.0.212
子网掩码: 255.255.255.0
默认网关: 192.168.0.254
dns:      192.168.0.212


vim /etc/resolv.conf
search localhost
nameserver 192.168.0.212

修改
/var/named/chroot/var/named/etc/named.caching-nameserver.conf

options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { any; };
        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; };
        forwarders { 8.8.8.8; }; //将解析不了的域名跳转到其他域名服务器进行解析
};
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";
};
将 localhost 都修改为 any

检查配置文件
# cd /var/named/chroot/var/named/etc/
# named-checkconf named.caching-nameserver.conf

修改 
/var/named/chroot/var/named/etc/named.rfc1912.zones

添加正向解析 zone
zone "jackie.com" IN {
        type master;
     &n