自学内容网 自学内容网

DNS实验作业

实验要求

1.搭建dns服务器能够对自定义的正向或者反向域完成数据解析查询。

2.配置从DNS服务器,对主dns服务器进行数据备份。

实验步骤:

1.关闭防护墙

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# setenforce 0

2.正向解析

[root@localhost ~]# vim /etc/named.conf

options {

        listen-on port 53 { 192.168.40.128;};

        directory       "/var/named";

        allow-query { any; };

};

zone "openlab.com" IN {

        type master;

        file "named.openlab.com";

};

[root@localhost ~]# vim /var/named/named.openlab.com

$TTL 1D

@       IN      SOA     @       wx.qq.com (

                                                2024110100

                                                1D

                                                2H

                                                5H

                                                1D )

        IN      NS      ns.openlab.com.

ns      IN      A       192.168.40.128

www     IN      A       192.168.75.111

wwww    IN      CNAME   www

3.反向解析

vim /etc/named.conf

options {

        listen-on port 53 { 192.168.40.128;};

        directory       "/var/named";

        allow-query { any; };

};

zone "openlab.com" IN {

        type master;

        file "named.openlab.com";

};

zone "75.168.192.in-addr.arpa" IN {

        type master;

        file "named.192";

        allow-update { none; };

};

4.配置文件

$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.

111     PTR     www.openlab.com.           

5.重启服务查询结果

[root@localhost ~]# systemctl restart named

[root@localhost ~]#nslookup

6.修改DNS服务器地址

[root@localhost ~]# vim /etc/resolv.conf

# Generated by NetworkManager

search localdomain

nameserver 192.168.40.128

7.通过从服务器进行数据备份

挂载并下载安装包

[root@localhost ~]# mount /dev/sr0 /mnt

[root@localhost ~]# yum  install  bind  -y

8.从服务器配置

[root@localhost ~]# vim /etc/named.conf

options {

        listen-on port 53 { 192.168.40.129; };

        directory       "/var/named/slaves";

        allow-query     { any; };

};

zone "openlab.com" IN{

        type slave;

        file "named.openlab.com";

        masters {192.168.40.128; };

};

zone "75.168.192.in-addr.arpa" IN{

        type slave;

        file "named.192";

        masters {192.168.40.128; };

};

9.修改主服务器配置

[root@localhost ~]# vim /etc/named.conf

options {

        listen-on port 53 { 192.168.40.128;};

        directory       "/var/named";

        allow-query { any; };

        allow-transfer{ 192.168.40.129; };

};

zone "openlab.com" IN {

        type master;

        file "named.openlab.com";

};

zone "75.168.192.in-addr.arpa" IN {

        type master;

        file "named.192";

        allow-update { none; };

};

10.完全区域传输

[root@localhost ~]# watch ls -l /var/named/slaves/

[root@localhost ~]# systemctl restart named

11.修改主服务器配置

[root@localhost ~]# vim /var/named/named.openlab.com

$TTL 1D

@       IN      SOA     @       wx.qq.com (

                                                2024110101

                                                1M     

                                                1M

                                                1M

                                                1M )

        IN      NS      ns.openlab.com.

        IN      NS      slave.openlab.com.

ns      IN      A       192.168.40.128

slave   IN      A       192.168.40.129

www     IN      A       192.168.40.111

ftp     IN      A       192.168.40.100

wwww    IN      CNAME   www

[root@localhost ~]# systemctl restart named


原文地址:https://blog.csdn.net/Ljn45521/article/details/143896951

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!