我在服务器上安装了dnsmasq。出于一些安全原因,我不允许修改/etc/host文件或创建任何其他主机文件来存储主机名和ip地址。
所以我在dnsmasq.conf文件中添加了主机名和ip地址,
address=/node01.black.system/10.248.11.21当我打字时
nslookup node01.black.system我得到了最终的ip地址。但它并没有破坏cersa。如果我做了
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-记录?
因为有大约100个节点,这需要服务器中任何一种方式的分辨率。
谢谢
发布于 2021-03-19 18:33:31
也许你正在寻找--主机-记录指令,它同时创建了一个A和PTR记录.
--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/host文件或创建任何其他主机,下面的内容可能不适用于您的情况;但我认为它们是有用的和相关的。这两个选项允许在正常/etc/主机和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.https://stackoverflow.com/questions/63682435
复制相似问题