DNS服务器布署
DNS服务器布署
1.搭建dns服务器能够对自定义的正向或者反向域完成数据解析查询。
2.配置从DNS服务器,对主dns服务器进行数据备份。
正反向解析
[root@localhost redhat]# vim /etc/named.conf
options {
listen-on port 53 { 192.168.79.128; };
directory "/var/named";
allow-query { any;};
zone "openlab.com" IN {
type master;
file "named.openlab.com";
};
zone "79.168.192.in-addr.arpa" IN {
type master;
file "named.192";
allow-update { none; };
};
[root@localhost redhat ]# vim /var/named/named.openlab.com ------正向资源记录文件
$TTL 1D
@ IN SOA @ lxx.qq.com.(
20241031
1D
1H
3H
1D
)
@ IN NS ns.openlab.com.
ns IN A 192.168.79.128
www IN A 192.168.79.130
ftp IN A 192.168.79.131
mail IN A 192.168.79.128
wwww IN CNAME www
[root@localhost redhat]# vim /var/named/named.192 ------反向资源记录文件
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.openlab.com.
128 PTR ns.openlab.com
130 PTR www.openlab.com
131 PTR ftp.openlab.com
关闭防火墙
[root@localhost redhat]# systemctl stop firewalld
[root@localhost redhat]# setenforce 0
[root@localhost redhat]# systemctl restart named
主从服务器
完全区域传送
主服务器配置:添加 allow-transfer { 192.168.111.128; };,其他不变。
主服务器
[root@localhost redhat]# vim /etc/named.conf
options {
listen-on port 53 { 192.168.79.131; };
directory "/var/named";
allow-query { any;};
allow-transfer { 192.168.79.128; }; ----------------添加
};
zone "openlab.com" IN {
type master;
file "named.openlab.com";
};
zone "111.168.192.in-addr.arpa" IN {
type master;
file "named.192";
allow-update { none; };
};
[root@localhost ~]# vim /var/named/named.openlab.com ------正向
$TTL 1D
@ IN SOA @ lxx.qq.com.(
20241031
1D
1H
3H
1D
)
@ IN NS ns.openlab.com.
ns IN A 192.168.79.128
www IN A 192.168.79.130
ftp IN A 192.168.79.131
mail IN A 192.168.79.128
wwww IN CNAME www
[root@localhost ~]# vim /var/named/named.192 ------反向
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.openlab.com.
128 PTR ns.openlab.com
130 PTR www.openlab.com
131 PTR ftp.openlab.com
关闭防火墙
[root@localhost redhat]# systemctl stop firewalld
[root@localhost redhat]# setenforce 0
[root@localhost redhat]# systemctl restart named
从服务器
[root@localhost redhat]# mount /dev/sr0 /mnt
mount: /mnt: /dev/sr0 already mounted on /mnt.
[root@localhost redhat]# systemctl disable firewalld
[root@localhost redhat]# setenforce 0
[root@localhost redhat]# dnf install bind
[root@localhost redhat]# vim /etc/named.conf
[root@localhost redhat]# cat /etc/named.conf
options {
listen-on port 53 { 192.168.79.128; };
directory "/var/named/slaves"; ------可以修改为/var/named/slaves
allow-query { any;};
};
zone "openlab.com" IN {
type slave; ----------------------------修改
file "named.openlab.com";
masters { 192.168.79.130; }; ----------------添加
};
zone "79.168.192.in-addr.arpa" IN {
type slave; ---------------------------修改
file "named.192";
masters { 192.168.79.130; }; ----------------添加
};
测试,重启从服务器主机后,在/var/named/slaves目录下可以看到正反向的资源记录文件
[root@localhost redhat]# ls -l /var/named/slaves/ -----此时从服务器下没有文件
total 0
[root@localhost redhat]# systemctl restart named -----从服务器重启后,在这个目录下可以看到正反向的资源记录文件
[root@localhost redhat]# ls -l /var/named/slaves/
total 8
-rw-r--r--. 1 named named 523 Nov 2 05:26 named.192
-rw-r--r--. 1 named named 396 Nov 2 05:26 named.openlab.com
原文地址:https://blog.csdn.net/Lxn_n/article/details/143488513
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!