dns主从配置

主DNS配置

安装

yum install bind -y

配置文件

vim /etc/named.conf
options {
//      listen-on port 53 { 127.0.0.1; }
//      allow-query     { localhost; };
		allow-transfer { 192.168.43.17; };
}

vim /etc/named.rfc1912.zones
zone "xuepeng.com" IN {
        type master;
        file "xuepeng.com.zone";
};

区域数据库文件

vim /var/named/xuepeng.com.zone
$TTL 1D
@       IN SOA  ns admin (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      ns
        NS      slave
ns      A       192.168.43.7
slave   A       192.168.43.17
web1    A       192.168.43.16
web2    A       192.168.43.26

启动服务

systemctl enable --now named

从DNS配置

安装

yum install bind -y

配置文件

vim /etc/named.conf
options {
//      listen-on port 53 { 127.0.0.1; }
//      allow-query     { localhost; };
		allow-transfer { none; };
}

vim /etc/named.rfc1912.zones
zone "xuepeng.com" IN {
        type slave;
        masters { 192.168.43.7; };
        file "slaves/xuepeng.com.zone";
};

启动服务

systemctl enable --now named

查看
在这里插入图片描述

测试

  1. 在主dns区域数据库中添加记录
  2. 修改序列号
  3. 重新加载服务
  4. 在客户端上测试

dig命令

抓取所有区域数据库数据
dig -taxfr xuepeng.com @192.168.43.7

发布了75 篇原创文章 · 获赞 2 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/studywinwin/article/details/104441057