NSS-RESOLVE(8)
π NSS-RESOLVE π
okay bestie, so this is the nss-resolve page β and yes it also goes by libnss_resolve.so.2, from the nss-resolve manual (section 8, systemd girlies rise up β¨).
β¨ NAME β¨
nss-resolve, libnss_resolve.so.2 β hostname resolution via systemd-resolved.service π¦
πΈ SYNOPSIS πΈ
libnss_resolve.so.2
π DESCRIPTION π
so nss-resolve is a plug-in module for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc), and what it does is let glibc resolve hostnames via the systemd-resolved(8) local network name resolution service. it literally replaces the nss-dns plug-in module that traditionally resolves hostnames via DNS. glow up π«Ά
to activate the NSS module, add "resolve [!UNAVAIL=return]" to the line starting with "hosts:" in /etc/nsswitch.conf. and specifically?? it's recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:" line. it should be before the "files" entry, since systemd-resolved supports /etc/hosts internally β but with caching β¨. to the contrary (drama), it should be after "mymachines", so that hostnames given to local VMs and containers get precedence over names received over DNS. finally, we recommend placing "dns" somewhere after "resolve", so you can fall back to nss-dns if systemd-resolved.service is not available. slay, resilience π
note that systemd-resolved will synthesize DNS resource records in a few cases, for example for "localhost" and the current local hostname β see systemd-resolved(8) for the full list. this duplicates the functionality of nss-myhostname(8), but it is still recommended (see examples below π) to keep nss-myhostname configured in /etc/nsswitch.conf, to keep those names resolvable if systemd-resolved is not running. no cap.
please keep in mind that nss-myhostname (and nss-resolve) also resolve in the other direction β from locally attached IP addresses to hostnames. if you rely on that lookup being provided by DNS, you might want to order things differently. it's giving β οΈ read the room β οΈ
communication between nss-resolve and systemd-resolved.service takes place via the /run/systemd/resolve/io.systemd.Resolve AF_UNIX socket. iconic little pipe π
π ENVIRONMENT VARIABLES π
$SYSTEMD_NSS_RESOLVE_VALIDATEβ takes a boolean argument. whenfalse, cryptographic validation of resource records via DNSSEC will be disabled. this may be useful for testing, or when system time is known to be unreliable. β°
added in version 250.
$SYSTEMD_NSS_RESOLVE_SYNTHESIZEβ takes a boolean argument. whenfalse, synthetic records, e.g. for the local host name, will not be returned. see sectionSYNTHETIC RECORDSinsystemd-resolved.service(8)for more information. this may be useful to query the"public"resource records, independent of the configuration of the local machine. π
added in version 250.
$SYSTEMD_NSS_RESOLVE_CACHEβ takes a boolean argument. whenfalse, the cache of previously queried records will not be used bysystemd-resolved(8). ποΈ
added in version 250.
$SYSTEMD_NSS_RESOLVE_ZONEβ takes a boolean argument. whenfalse, answers using locally registered public LLMNR/mDNS resource records will not be returned. π‘
added in version 250.
$SYSTEMD_NSS_RESOLVE_TRUST_ANCHORβ takes a boolean argument. whenfalse, answers using locally configured trust anchors will not be used. β
added in version 250.
$SYSTEMD_NSS_RESOLVE_NETWORKβ takes a boolean argument. whenfalse, answers will be returned without using the network, i.e. either from local sources or the cache insystemd-resolved(8). βοΈ
added in version 250.
$SYSTEMD_NSS_RESOLVE_INTERFACEβ takes an interface name or index as an argument. when specified, answers will only be obtained from name servers belonging to the specified interface. π
added in version 260.
π EXAMPLE π
here is an example /etc/nsswitch.conf file that enables nss-resolve correctly β copy it, bestie, it ate π
:
passwd: files systemd
group: files [SUCCESS=merge] systemd
shadow: files systemd
gshadow: files systemd
hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
π SEE ALSO π
systemd(1), systemd-resolved(8), nss-systemd(8), nss-myhostname(8), nss-mymachines(8), nsswitch.conf(5), systemd.syntax(7)
and that's the whole page, bestie!! this one's from systemd 262.1 β go resolve some hostnames, you're the main character now π¦πβ¨ periodt.
π¦ where this page comes from
- arch rolling: systemd-libs 262.1-1 Β· LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later WITH Linux-syscall-note
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms