DNSMasq 中的多个 addn-hosts conf

Multiple addn-hosts conf in DNSMasq

是否可以将多个文件添加到dnsmasq.conf中的"addn-hosts"节点?

目前我有一个文件"dnsmasq.multihosts",其中有一个供 DNSmasq 解析的服务器列表。我的问题是 dnsmasq.multihosts 现在太长了,我想将它分成多个文件,如 "dnsmasq.database"、"dnsmasq.webserver" 等以便于维护。

是的,可以在 dnsmasq.conf 中为 --addn-hosts 指定多个文件。可以为多个附加主机文件重复此选项。如果给出目录,则将读取该目录中的所有文件。

dnsmasq --help
...
-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.

dnsmasq 手册页位于 http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html