Bind配置主从

环境

系统:CentOS 6.6
软件:bind-9.10.2.tar.gz
域名:yourdomain.com
网段:192.168.10.0/24
主DNS服务器:dns1.yourdomain.com 192.168.10.10
从DNS服务器:dns2.yourdomain.com 192.168.10.20

bind安装

在主DNS和从DNS服务器上安装bind
参见:http://www.jianshu.com/p/1cffc6c59ec2

主DNS配置

  • 添加配置
# vim /etc/named/named.conf
......

options {
......
        allow-transfer  { 192.168.10.20; };
};

......

zone "yourdomain.com" IN {
        type    master;
        file    "db.yourdomain.com";
};


zone "10.168.192.in-addr.arpa" IN {
        type    master;
        file    "db.192.168.10";
};

......
  • 修改yourdomain.com域正向解析文件
# vim /data/named/db.yourdomain.com
......
@                       IN      NS      dns1.yourdomain.com.
@                       IN      NS      dns2.yourdomain.com.
......
  • 修改192.168.10.0/24网段反向解析文件
......
@       IN      NS      dns1.yourdomain.com.
@       IN      NS      dns2.yourdomain.com.
......
  • 重启
    # /etc/init.d/named restart
    

从DNS配置

  • 修改配置
# vim /etc/named/named.conf
......

zone "yourdomain.com" IN {
        type    slave;
        file    "db.yourdomain.com";
        masters { 192.168.10.10; };
};

zone "10.168.192.in-addr.arpa" IN {
        type    slave;
        file    "db.192.168.10";
        masters { 192.168.10.10; };
};

......
  • 删除解析文件
# ls /data/named/ | grep -v 'db.ca' | xargs rm -f
  • 重启
# /etc/init.d/named restart

你可能感兴趣的:(Bind配置主从)