Страница справочника для systemd-resolved.service
говорит:
systemd-resolved
поддерживает/run/systemd/resolve/stub-resolv.conf
файл для совместимости с традиционными программами Linux. Этот файл может быть symlinked от/etc/resolv.conf
. Это списки файлов 127.0.0.53 тупика DNS (см. выше) как единственный сервер DNS. Это также содержит список областей поиска, которые используютсяsystemd-resolved
. Список областей поиска всегда в курсе.
(Шахта Emphasis.) "Список областей поиска всегда совершенствуется", кажется, подразумевает, что список синхронизируется от где-то в другом месте, но не указывает где. Куда этот список областей поиска прибывает из? В частности, как я изменяю его?
Путь поиска обновляется от DHCP. В моем маршрутизаторе эту установку называют "Доменным именем".
Для обновления пути поиска, я установил домен в своем маршрутизаторе и затем возобновил арендный договор DHCP о моей машине Ubuntu (service network-manager restart
или перезагрузка).
systemd-resolve --status
whill затем показывают этот домен "Доменом DNS", и он обнаружится в /run/systemd/resolve/stub-resolv.conf
как a search
директива.
Обратите внимание что dig
команда не использует поисковый список в /etc/resolv.conf
по умолчанию. Добавьте +search
опция включить это:
dig +search some-hostname
В моей системе 18.04.3 man resolved.conf предлагает изменить строку Domains = файла /etc/systemd/resolved.conf. Отрывок ниже:
Domains=
A space-separated list of domains. These domains are used as search suffixes when resolving single-label host names
(domain names which contain no dot), in order to qualify them into fully-qualified domain names (FQDNs). Search
domains are strictly processed in the order they are specified, 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 are used
instead, if that file exists and any domains are configured in it. This setting defaults to the empty list.
Specified domain names may optionally be prefixed with "~". In this case they do not define a search path, but
preferably direct DNS queries for the indicated domains to the DNS servers configured with the system DNS= setting
(see above), in case additional, suitable per-link DNS servers are known. If no per-link DNS servers are known using
the "~" syntax has no effect. Use the construct "~." (which is composed of "~" to indicate a routing domain and "."
to indicate the DNS root domain that is the implied suffix of all DNS domains) to use the system DNS server defined
with DNS= preferably for all domains.
Сделав это и перезапустив systemd-resolved, мой /etc/resolv.conf теперь содержит нужные мне поисковые домены (так как я настроил статический адрес на этом сервере Ubuntu - он ничего не подберет. из DHCP)