微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

dnsmasq反向iplookup在配置文件中没有ptr记录的情况下不起作用

如何解决dnsmasq反向iplookup在配置文件中没有ptr记录的情况下不起作用

我的服务器中安装了dnsmasq。出于安全原因,不允许我修改/ etc / hosts文件或创建任何其他主机文件来存储主机名和IP地址。

因此在dnsmasq.conf文件中,我添加了主机名和IP地址,

address=/node01.black.system/10.248.11.21

当我键入

nslookup node01.black.system

我得到结果IP地址。但这不是副主席。 如果我愿意

nslookup 10.248.11.21

我正在获取服务器找不到...:NXDOMAIN

但是,当我在dnsmasq.conf文件添加ptr记录时

ptr-record=21.11.248.10.in-addr.arpa.,node01.black.system

然后如果我键入

nslookup 10.248.11.21

我正在得到结果主机名。有没有办法在不添加ptr-record的情况下同时实现这两种方式?

因为大约有100个节点,所以服务器中的任何一种方式都需要解析

谢谢

解决方法

也许您正在寻找创建 A 和 PTR 记录的 --host-record 指令。

 --host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>][,<TTL>]
   Add A,AAAA and PTR records to the DNS...

例如

host-record=node01.black.system,10.248.11.21

而根据 dnsmasq 手册页,address 选项是为域中的任何地址定义返回的 IP。它没有提到创建 PTR 记录。

 -A,--address=/<domain>/[domain/]<ipaddr>
   Specify  an  IP address to return for any host in the given domains. 
   Queries in the domains are never forwarded and always replied to with
   the specified IP address which may be IPv4 or IPv6.

由于您无法修改 /etc/hosts 文件或创建任何其他主机,因此以下内容可能不适用于您的情况;但我认为它们有用且相关。这两个选项允许在正常的 /etc/hosts 和 dnsmasq 配置之外定义主机。

 -H,--addn-hosts=<file>
   Additional  hosts  file.  Read  the specified file as well as /etc/hosts. 
   If -h is given,read only the specified file. This option may be repeated for 
   more than one additional hosts file. If a directory is given,then
   read all the files contained in that directory.

 --hostsdir=<path>
   Read all the hosts files contained in the directory. New or changed files are 
   read automatically. See --dhcp-hostsdir for details.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。