赞
踩
DNS(Domain Name System)是一种用于将域名解析为IP地址的系统。
在DNS中,正向解析将域名转换为IP地址,而反向解析将IP地址转换为域名。
正向解析是DNS系统最常用的解析方式,它允许用户通过域名找到该域名对应的IP地址。例如,在浏览器中输入www.google.com时,DNS会将该域名解析为IP地址,然后将请求发送给该IP地址上的服务器。
反向解析则是与正向解析相反的过程。它将IP地址转换为域名。这通常用于安全和网络管理目的,例如确定某个IP地址是否被黑名单或查找特定主机名的IP地址。
需要注意的是,反向解析需要在DNS服务器上进行设置,并且仅适用于那些已经注册了域名的IP地址,因此,并不是所有IP地址都可以被反向解析。
- [root@localhost ~]# mount /dev/sr0 /mnt/
- [root@localhost ~]# yum install bind- -y
- [root@localhost ~]# systemctl stop firewalld
- [root@localhost ~]# setenforce 0
- [root@localhost ~]# vim /etc/named.conf
-
- options {
- #定义监听端口,如果所有地址都监听,则只写端口
- listen-on port 53 { 192.168.186.137; };
- #定义数据文件目录
- directory "/var/named";
- #只允许本地主机进行查询
- allow-query { any; };
- recursion yes;
- };
-
- #定义区域
- zone "openlab.com" IN {
- type master;
- file "named.openlab.com";
- };
- [root@localhost ~]# vim /var/named/named.openlab.com
-
-
- @ IN SOA ns.openlab.com. admin.qq.com. (
- 2023051002
- 1M
- 1M
- 1M
- 3M )
- NS ns.openlab.com.
- ns A 192.168.186.137
- ftp A 192.168.186.100
- www A 192.168.186.111
- http CNAME www
-
-
- [root@localhost ~]# vim /etc/resolv.conf
-
- # Generated by NetworkManager
- search localdomain
- nameserver 192.168.186.138
- [root@localhost ~]# host www.openlab.com
- www.openlab.com has address 192.168.186.111
- [root@localhost ~]# mount /dev/sr0 /mnt/
- [root@localhost ~]# yum install bind- -y
- [root@localhost ~]# systemctl stop firewalld
- [root@localhost ~]# setenforce 0
- [root@localhost ~]# vim /etc/named.conf
-
- options {
- listen-on port 53 { 192.168.186.137; };
- directory "/var/named";
- allow-query { any; };
- recursion yes;
- };
-
- #正向解析
- zone "openlab.com" IN {
- type master;
- file "named.openlab.com";
- };
-
- #反向解析
- zone "186.168.192.in-addr.arpa" IN {
- type master;
- file "named.openlab.com";
- };
- [root@localhost ~]# vim /var/named/named.openlab.com
-
- $TTL 1D
- @ IN SOA ns.openlab.com. admin.qq.com. (
- 2023051002
- 1M
- 1M
- 1M
- 3M )
- NS ns.openlab.com.
- ns A 192.168.186.137
- ftp A 192.168.186.100
- www A 192.168.186.111
- http CNAME www
- 137 PTR ns.openlab.com.
- 100 PTR www.openlab.com.
- 111 PTR ftp.openlab.com.
-
- [root@localhost ~]# vim /etc/resolv.conf
-
- # Generated by NetworkManager
- search localdomain
- nameserver 192.168.186.138
- [root@localhost ~]# nslookup 192.168.186.111
- 111.186.168.192.in-addr.arpa name = ftp.openlab.com.
-
- [root@localhost ~]# nslookup 192.168.186.100
- 100.186.168.192.in-addr.arpa name = www.openlab.com.
-
- [root@localhost ~]# nslookup 192.168.186.137
- 137.186.168.192.in-addr.arpa name = ns.openlab.com.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。