NSS-RESOLVE(8)
π NSS-RESOLVE(8) β the nss-resolve glow-up
okay so bestie, welcome to the nss-resolve manual page, straight out of the nss-resolve corner of the systemd world. This is nss-resolve, aka libnss_resolve.so.2, and she's literally the friend who hooks you up with hostname resolution through systemd-resolved.service. Let's get into it π
β¨ NAME β¨
nss-resolve, libnss_resolve.so.2 β hostname resolution via systemd-resolved.service. That's the whole vibe. Iconic, honestly.
π¦ 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 she does is enable glibc to resolve hostnames via the systemd-resolved(8) local network name resolution service. She's basically taking over from the nss-dns plug-in module that traditionally resolves hostnames via DNS. Slay, evolution π
To activate the NSS module, add "resolve [!UNAVAIL=return]" to the line starting with "hosts:" in /etc/nsswitch.conf. And specifically? It is 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, it should be after "mymachines", to give hostnames given to local VMs and containers precedence over names received over DNS. Finally, we recommend placing "dns" somewhere after "resolve", to fall back to nss-dns if systemd-resolved.service is not available. Order matters, bestie, no cap π«Ά
Note thatsystemd-resolvedwill synthesize DNS resource records in a few cases, for example for"localhost"and the current local hostname β seesystemd-resolved(8)for the full list. This duplicates the functionality ofnss-myhostname(8), but it is still recommended (see examples below) to keepnss-myhostnameconfigured in/etc/nsswitch.conf, to keep those names resolveable ifsystemd-resolvedis not running.
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 plot twist, but it's real π
Communication between nss-resolve and systemd-resolved.service takes place via the /run/systemd/resolve/io.systemd.Resolve AF_UNIX socket. That's the little private line they text on π
π§ ENVIRONMENT VARIABLES π§
$SYSTEMD_NSS_RESOLVE_VALIDATEβ takes a boolean argument. When false, 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. When false, 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. When false, 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. When false, 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. When false, answers using locally configured trust anchors will not be used. Added in version 250.$SYSTEMD_NSS_RESOLVE_NETWORKβ takes a boolean argument. When false, answers will be returned without using the network, i.e. either from local sources or the cache insystemd-resolved(8). Added in version 250.
β EXAMPLE β
Here is an example /etc/nsswitch.conf file that enables nss-resolve correctly. Copy it, screenshot it, put it on your moodboard, whatever works π
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)
Go read those too, bestie β the lore is deep π
and that's the page!! This absolutely iconic piece of documentation is from systemd 257.13, and she's dated NSS-RESOLVE(8) β periodt, go resolve some hostnames ππ¦β¨
π¦ where this page comes from
- debian trixie: libnss-resolve 257.13-1~deb13u1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: systemd-resolved 257.13-160000.4.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: systemd-resolved 257.13-160000.4.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: systemd-resolved 257.13-160000.4.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: systemd-resolved 257.13-160000.4.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms