我试图让 resolvconf 在使用“resolvconf -u”运行时在 /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 定义,但它仍然不接受它们。我在手册中找不到任何有关正确语法的信息。
答案1
/sbin/resolvconf
实际上是一个 shell 脚本,配置文件只是源脚本,因此您需要的语法与 shell 脚本相同:
name_servers="1.1.1.1 1.0.0.1"