搭建DNS 服务

发布时间:2024年01月22日
安装DNS?服务

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

Complete!

[root@localhost?~]#

DNS?配置文件

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

[root@localhost?~]#?cat?-n?/etc/named.conf?

?????1??//

...

????12??options?{

????13??????#listen-on?port?53?{?127.0.0.1;?};

????14??????listen-on?port?53?{?192.168.1.254;?};

????15??????listen-on-v6?port?53?{?::1;?};

????16??????directory???"/var/named";

????17??????dump-file???"/var/named/data/cache_dump.db";

????18??????statistics-file?"/var/named/data/named_stats.txt";

????19??????memstatistics-file?"/var/named/data/named_mem_stats.txt";

????20??????#allow-query?????{?localhost;?};

...

????33??

????34??????#dnssec-enable?yes;

????35??????dnssec-enable?no;

????36??????#dnssec-validation?yes;

????37??????dnssec-validation?no;

...

????62??

[root@localhost?~]#

DNS?服务管理

[root@localhost?~]#?systemctl?start?named.service?

[root@localhost?~]#?systemctl?enable?named.service?

Created?symlink?from?/etc/systemd/system/multi-user.target.wants/named.service?to?/usr/lib/systemd/system/named.service.

[root@localhost?~]#?netstat?-anptul?|?grep?"named"

tcp????????0??????0?192.168.1.254:53????????0.0.0.0:*???????????????LISTEN??????11217/named?????????

tcp????????0??????0?127.0.0.1:953???????????0.0.0.0:*???????????????LISTEN??????11217/named?????????

tcp6???????0??????0?::1:53??????????????????:::*????????????????????LISTEN??????11217/named?????????

tcp6???????0??????0?::1:953?????????????????:::*????????????????????LISTEN??????11217/named?????????

udp????????0??????0?192.168.1.254:53????????0.0.0.0:*???????????????????????????11217/named?????????

udp6???????0??????0?::1:53??????????????????:::*????????????????????????????????11217/named?????????

[root@localhost?~]#

DNS?解析验证

DNS?欺骗

DNS?配置

主配置文件

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

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

...

zone?"jd.com"?IN?{

????type?master;

????file?"jd.com.zone";

};

...

[root@localhost?~]#

区域配置文件

[root@localhost?~]#?cd?/var/named/

[root@localhost?named]#?cp?-a?named.empty?jd.com.zone

[root@localhost?named]#?vim?jd.com.zone?

[root@localhost?named]#?cat?jd.com.zone?

$TTL?3H

@???IN?SOA??jd.com.?root.jd.com.?(

????????????????????0???;?serial

????????????????????1D??;?refresh

????????????????????1H??;?retry

????????????????????1W??;?expire

????????????????????3H?)????;?minimum

????NS??ns.jd.com.

ns??A???192.168.1.254

www?A???172.16.1.100

[root@localhost?named]#

重置生效

主配置文件

区域配置文件

DNS?欺骗验证

HTTPD?服务

在Server?上安装HTTPD?服务。

[root@localhost?~]#?yum?install?httpd?-y

...

Complete!

[root@localhost?~]#?systemctl?list-unit-files?|grep?"httpd.service"

httpd.service?????????????????????????????????disabled

[root@localhost?~]#?systemctl?start?httpd.service?

[root@localhost?~]#

使用client访问server

文章来源:https://blog.csdn.net/qq_45212316/article/details/135739908
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。