是否可以在Unix系统的/etc/resolv.conf中列出多个名称服务器,并且在进行DNS查询时使用随机的名称服务器来parsingDNS查询,而不仅仅是第一个?
对于Linux系统,我使用/etc/resolv.conf的timeout和rotate选项…我通常将DNS超时降低到1秒。
timeout:n sets the amount of time the resolver will wait for a response from a remote name server before retrying the query via a different name server. Measured in seconds, the default is RES_TIMEOUT (currently 5, see <resolv.h>). The maximum value for this option is silently capped to 30.
和
rotate sets RES_ROTATE in _res.options, which causes round robin selection of nameservers from among those listed. This has the effect of spreading the query load among all listed servers, rather than having all clients try the first listed server first every time.
在Linux上parsingDNS有不同的随机化或伪随机化。
/etc/resolv.conf “期权旋转”是一种客户端循环,因此可以被认为是一个穷人随机化。 但是,libcparsing器最多支持3个不同的服务器。 这里是一个示例/etc/resolv.conf ,使用3个stream行的,可靠的公共DNS服务器。
options timeout:1 options rotate # resolver1.level3.net nameserver 209.244.0.3 # resolver1.opendns.com nameserver 208.67.222.222 # google-public-dns-a.google.com nameserver 8.8.8.8
使用dnsmasq,可以使用3个以上的转发名称服务器 。 服务器不是纯粹随机select的,但是每50个查询或10秒钟确实是伪随机更改的。 这可以通过logging查询( log-queries )来检查。
在/etc/resolv.conf :
nameserver 127.0.0.1
在/etc/dnsmasq.conf
resolv-file /etc/resolv.dnsmasq
在/etc/resolv.dnsmasq
# dns1.alternate-dns.com nameserver 198.101.242.72 # resolver1.dyndnsinternetguide.com nameserver 216.146.35.35 # dns1.safedns.com nameserver 195.46.39.39 # resolver1.level3.net nameserver 209.244.0.3 # ns1.recursive.dnsbycomodo.com nameserver 8.26.56.26 # ordns.he.net nameserver 74.82.42.42 # dns.yandex.ru nameserver 77.88.8.8 # resolver1.opendns.com nameserver 208.67.222.222 # google-public-dns-a.google.com nameserver 8.8.8.8 # rdns1.ultradns.net nameserver 156.154.70.1
没有绑定时,也可以指定多个parsing器(多于3个)。 随机logging如下:
当需要发送查询时,select最快的服务器(在400毫秒的所谓的RTT频带内随机挑选)
https://www.unbound.net/documentation/info_timeout.html
在/etc/resolv.conf :
nameserver 127.0.0.1
在/etc/unbound/unbound.conf :
forward-zone: name: "." # google #forward-addr: 8.8.8.8 # fnd.org forward-addr: 80.67.169.12 # comodo forward-addr: 8.26.56.26 # level 3 forward-addr: 209.244.0.3
简答:不,不是。
较长的回答:尽pipe几乎所有的Unix变体都使用文件/etc/resolv.conf来进行全局名称parsingconfiguration,但实际上并不是所有的实际上都使用相同的parsing器库来完成这项工作。 这可能是你的特定版本的Unix可以做你想做的,但是要发现你必须阅读它自己的文档。 而且,它根本不是可移植的。