构建DNS从域名服务器(主192.168.200.111 从192.168.200.112)
作者:互联网
前提准备,关闭防火墙,安装软件:
[root@localhost ~]# iptables -F
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# yum -y install bind bind-libs bind-utils
主服务器配置:
修改以下两个文件保持同步
[root@localhost ~]# vim /etc/hosts
192.168.200.111 ns1.crushlinux.com
192.168.200.112 ns2.crushlinux.com
[root@localhost ~]# vim /etc/resolv.conf
nameserver 192.168.200.111
nameserver 192.168.200.112
修改主服务器配置文件
[root@localhost ~]# vim /etc/named.conf
options {
directory "/var/named";
};
zone "crushlinux.com" IN {
type master;
file "crushlinux.zheng";
allow-transfer { 192.168.200.112; };
};
zone "200.168.192.in-addr.arpa" IN {
type master;
file "crushlinux.fan";
allow-transfer { 192.168.200.112; };
};
修改解析分区文件
[root@localhost ~]# vim /var/named/crushlinux.zheng
$TTL 86400
@ SOA crushlinux.com. admin.crushlinux.com. (
20200312
3H
15M
1W
1D
)
IN NS ns1.crushlinux.com.
IN NS ns2.crushlinux.com.
IN MX 10 mail.crushlinux.com.
ns1 IN A 192.168.200.111
ns2 IN A 192.168.200.112
www IN A 192.168.200.111
mail IN A 192.168.200.112
study IN A 192.168.200.113
* IN A 192.168.200.113
[root@localhost ~]# vim /var/named/crushlinux.fan
$TTL 86400
@ SOA crushlinux.com. admin.crushlinux.com. (
20200312
3H
15M
1W
1D
)
IN NS ns1.crushlinux.com.
IN NS ns2.crushlinux.com.
IN MX 10 mail.crushlinux.com.
111 IN PTR ns1.crushlinux.com.
112 IN PTR ns2.crushlinux.com.
111 IN PTR www.crushlinux.com.
112 IN PTR mail.crushlinux.com.
113 IN PTR study.crushlinux.com.
[root@localhost ~]# systemctl restart named
从服务器配置:
关系防火墙,安装软件:
[root@localhost ~]# iptables -F
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# yum -y install bind bind-libs bind-utils
[root@localhost ~]# cp /etc/named.conf /etc/named.conf.bak
修改主配置文件
[root@localhost ~]# vim /etc/named.conf
options {
directory "/var/named";
};
zone "crushlinux.com" IN {
type slave; 类型
file "slaves/crushlinux.zheng"; 下载的文件
masters { 192.168.200.111; }; 主DNS服务器ip地址
};
zone "200.168.192.in-addr.arpa" IN {
type slave;
file "slaves/crushlinux.fan";
masters { 192.168.200.111; };
};
[root@localhost ~]# systemctl start named
[root@localhost ~]# ls /var/named/slaves/
crushlinux.fan crushlinux.zheng
显示两个文件,说明可以从主DNS系统下载
标签:named,200.111,root,200.112,192.168,com,localhost,crushlinux 来源: https://blog.csdn.net/aaaa_xiebiao/article/details/104851163