Dns
如何在 resolvconf.conf 中指定多個 DNS?
當使用“resolvconf -u”執行時,我試圖讓 resolvconf 在 /etc/resolv.conf 中添加兩個額外的名稱伺服器。我的 /etc/resolvconf.conf 文件如下:
# Configuration for resolvconf(8) # See resolvconf.conf(5) for details resolv_conf=/etc/resolv.conf # If you run a local name server, you should uncomment the below line and # configure your subscribers configuration files below. name_servers=1.1.1.1 1.0.0.1 # Mirror the Debian package defaults for the below resolvers # so that resolvconf integrates seemlessly. dnsmasq_resolv=/var/run/dnsmasq/resolv.conf pdnsd_conf=/etc/pdnsd.conf unbound_conf=/var/cache/unbound/resolvconf_resolvers.conf
當我執行命令“resolvconf -u”時出現問題,這是我得到的輸出:
/sbin/resolvconf: 7: /etc/resolvconf.conf: 1.0.0.1: not found /sbin/resolvconf: 7: /etc/resolvconf.conf: 1.0.0.1: not found /sbin/resolvconf: 7: /etc/resolvconf.conf: 1.0.0.1: not found /sbin/resolvconf: 7: /etc/resolvconf.conf: 1.0.0.1: not found /sbin/resolvconf: 7: /etc/resolvconf.conf: 1.0.0.1: not found /sbin/resolvconf: 7: /etc/resolvconf.conf: 1.0.0.1: not found
如果我在 name_servers 行中只指定一個 DNS,它就可以正常工作。我還嘗試用“”包裝 DNS 定義,但它仍然不接受它們。我在手冊中找不到有關正確語法的任何資訊。
/sbin/resolvconf
實際上是一個 shell 腳本,配置文件只是源腳本,所以您需要的語法與 shell 腳本相同:name_servers="1.1.1.1 1.0.0.1"