首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如果没有配置文件中的ptr记录,dnsmasq反向iplookup就无法工作

如果没有配置文件中的ptr记录,dnsmasq反向iplookup就无法工作
EN

Stack Overflow用户
提问于 2020-09-01 06:25:09
回答 1查看 2.5K关注 0票数 1

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

所以我在dnsmasq.conf文件中添加了主机名和ip地址,

代码语言:javascript
复制
address=/node01.black.system/10.248.11.21

当我打字时

代码语言:javascript
复制
nslookup node01.black.system

我得到了最终的ip地址。但它并没有破坏cersa。如果我做了

代码语言:javascript
复制
nslookup 10.248.11.21

我得到服务器找不到.:NXDOMAIN

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

代码语言:javascript
复制
ptr-record=21.11.248.10.in-addr.arpa., node01.black.system

如果我打字

代码语言:javascript
复制
nslookup 10.248.11.21

我要得到结果主机名。有没有一种方法可以让这两种方式都工作,而不添加ptr-记录?

因为有大约100个节点,这需要服务器中任何一种方式的分辨率。

谢谢

EN

回答 1

Stack Overflow用户

发布于 2021-03-19 18:33:31

也许你正在寻找--主机-记录指令,它同时创建了一个A和PTR记录.

代码语言:javascript
复制
 --host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>][,<TTL>]
   Add A, AAAA and PTR records to the DNS...

例如:

代码语言:javascript
复制
host-record=node01.black.system,10.248.11.21

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

代码语言:javascript
复制
 -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/host文件或创建任何其他主机,下面的内容可能不适用于您的情况;但我认为它们是有用的和相关的。这两个选项允许在正常/etc/主机和dnsmasq配置之外定义主机。

代码语言:javascript
复制
 -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.
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63682435

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档