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
37 Please keep in mind that nss-myhostname (and nss-resolve) also resolve
38 in the other direction — from locally attached IP adresses to
39 hostnames. If you rely on that lookup being provided by DNS, you might
40 want to order things differently.
41
42 Communication between nss-resolve and systemd-resolved.service takes
43 place via the /run/systemd/resolve/io.systemd.Resolve AF_UNIX socket.
44
46 Here is an example /etc/nsswitch.conf file that enables nss-resolve
47 correctly:
48
49 passwd: compat systemd
50 group: compat [SUCCESS=merge] systemd
51 shadow: compat systemd
52 gshadow: files systemd
53
54 hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
55 networks: files
56
57 protocols: db files
58 services: db files
59 ethers: db files
60 rpc: db files
61
62 netgroup: nis
63
65 systemd(1), systemd-resolved(8), nss-systemd(8), nss-myhostname(8),
66 nss-mymachines(8), nsswitch.conf(5)
67
68
69
70systemd 249 NSS-RESOLVE(8)