systemd-resolved

systemd-resolved

/etc/resolv.conf symlink

nameserver 127.0.0.53 の stub を利用する場合:

ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

nameserver 192.0.2.1 のリゾルバ IP アドレス直指定を利用する場合:

ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
  • Debian 11 apt install systemd-resolved 追加後
$ ll /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Aug  2  2023 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

$ ll /run/systemd/resolve
total 8.0K
drwxr-xr-x  2 systemd-resolve systemd-resolve 100 Feb 24 16:12 .
drwxr-xr-x 21 root            root            520 Feb 24 13:24 ..
srw-rw-rw-  1 systemd-resolve systemd-resolve   0 Feb 24 11:41 io.systemd.Resolve
-rw-r--r--  1 systemd-resolve systemd-resolve 761 Feb 24 16:12 resolv.conf
-rw-r--r--  1 systemd-resolve systemd-resolve 738 Feb 24 16:12 stub-resolv.conf

systemd-resolved 側で 4 つとか設定しておくと、「Too many DNS servers configured, the following entries may be ignored.」と警告される。

$ cat /run/systemd/resolve/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 2606:4700:4700::1111
# Too many DNS servers configured, the following entries may be ignored.
nameserver 2606:4700:4700::1001
search .
$ cat /run/systemd/resolve/stub-resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad
search .
$ systemd-resolve --version
systemd 247 (247.3-7+deb11u4)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified
最終更新日