1NSS-RESOLVE(8) nss-resolve NSS-RESOLVE(8)
2
3
4
6 nss-resolve, libnss_resolve.so.2 - Hostname resolution via
7 systemd-resolved.service
8
10 libnss_resolve.so.2
11
13 nss-resolve is a plug-in module for the GNU Name Service Switch (NSS)
14 functionality of the GNU C Library (glibc) enabling it to resolve
15 hostnames via the systemd-resolved(8) local network name resolution
16 service. It replaces the nss-dns plug-in module that traditionally
17 resolves hostnames via DNS.
18
19 To activate the NSS module, add "resolve [!UNAVAIL=return]" to the line
20 starting with "hosts:" in /etc/nsswitch.conf. Specifically, it is
21 recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:"
22 line. It should be before the "files" entry, since systemd-resolved
23 supports /etc/hosts internally, but with caching. To the contrary, it
24 should be after "mymachines", to give hostnames given to local VMs and
25 containers precedence over names received over DNS. Finally, we
26 recommend placing "dns" somewhere after "resolve", to fall back to
27 nss-dns if systemd-resolved.service is not available.
28
29 Note that systemd-resolved will synthesize DNS resource records in a
30 few cases, for example for "localhost" and the current local hostname,
31 see systemd-resolved(8) for the full list. This duplicates the
32 functionality of nss-myhostname(8), but it is still recommended (see
33 examples below) to keep nss-myhostname configured in
34 /etc/nsswitch.conf, to keep those names resolveable if systemd-resolved
35 is not running.
36
38 Here is an example /etc/nsswitch.conf file that enables nss-resolve
39 correctly:
40
41 passwd: compat systemd
42 group: compat [SUCCESS=merge] systemd
43 shadow: compat
44
45 hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
46 networks: files
47
48 protocols: db files
49 services: db files
50 ethers: db files
51 rpc: db files
52
53 netgroup: nis
54
56 systemd(1), systemd-resolved(8), nss-systemd(8), nss-myhostname(8),
57 nss-mymachines(8), nsswitch.conf(5)
58
59
60
61systemd 248 NSS-RESOLVE(8)