是否可以为地址解析配置依赖于域的名称服务器(例如 resolv.conf)?
例如
nameserver 1.2.3.4 for any domain abc.com
nameserver 4.3.2.1 for any domain cba.com
nameserver 1.4.2.3 for anything else
Run Code Online (Sandbox Code Playgroud)
我正在使用现代 Debian。
您不能只使用resolv.conf
,而是使用中间 DNS 转发守护程序,例如Dnsmasq(在 Debiandnsmasq
和相关软件包中打包)。
使用 Dnsmasq,您可以使用服务器列表配置 Dnsmasq 本身:
server=/abc.com/1.2.3.4
server=/cba.com/4.3.2.1
server=1.4.2.3
Run Code Online (Sandbox Code Playgroud)
并告诉它不要看resolv.conf
:
no-resolv
Run Code Online (Sandbox Code Playgroud)
然后你会改变你的resolv.conf
指向 Dnsmasq 守护进程,通过删除nameserver
其中的所有条目。您还需要确保任何 DHCP 设置都不会覆盖resolv.conf
.
归档时间: |
|
查看次数: |
375 次 |
最近记录: |