为什么 /etc/systemd/resolved.conf 中的域不生效?

为什么 /etc/systemd/resolved.conf 中的域不生效?

我正在使用 Ubuntu 20.04,我需要添加一个新的 DNS 搜索域。目前 /etc/resolv.conf 中的“搜索”字段如下:

search mshome.net

我需要在“mshome.net”前面添加“mine.net”。我所做的是直接编辑文件并更改为:

search mine.net mshome.net

成功了。但是文件中有一些注释说这个文件是生成的,我想有更好的方法。我检查了一下已解析的配置文件手册页中,它有这个 -

   Domains=
       A space-separated list of domains optionally prefixed with
       "~", used for two distinct purposes described below. Defaults
       to the empty list.

       Any domains not prefixed with "~" are used as search suffixes
       when resolving single-label hostnames (domain names which
       contain no dot), in order to qualify them into
       fully-qualified domain names (FQDNs). These "search domains"
       are strictly processed in the order they are specified in,
       until the name with the suffix appended is found. For
       compatibility reasons, if this setting is not specified, the
       search domains listed in /etc/resolv.conf with the search
       keyword are used instead, if that file exists and any domains
       are configured in it.

我编辑了文件 /etc/systemd/resolved.conf 并添加了 mine.net:

Domains=mine.net mshome.net

编辑后,我运行了这个:

sudo systemctl restart systemd-resolved

但它没有起作用。

你知道我错过了什么吗?

相关内容