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 addresses 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 $SYSTEMD_NSS_RESOLVE_VALIDATE
47 Takes a boolean argument. When false, cryptographic validation of
48 resource records via DNSSEC will be disabled. This may be useful
49 for testing, or when system time is known to be unreliable.
50
51 $SYSTEMD_NSS_RESOLVE_SYNTHESIZE
52 Takes a boolean argument. When false, synthetic records, e.g. for
53 the local host name, will not be returned. See section SYNTHETIC
54 RECORDS in systemd-resolved.service(8) for more information. This
55 may be useful to query the "public" resource records, independent
56 of the configuration of the local machine.
57
58 $SYSTEMD_NSS_RESOLVE_CACHE
59 Takes a boolean argument. When false, the cache of previously
60 queried records will not be used by systemd-resolved.
61
62 $SYSTEMD_NSS_RESOLVE_ZONE
63 Takes a boolean argument. When false, answers using locally
64 registered public LLMNR/mDNS resource records will not be returned.
65
66 $SYSTEMD_NSS_RESOLVE_TRUST_ANCHOR
67 Takes a boolean argument. When false, answers using locally
68 configured trust anchors will not be used.
69
70 $SYSTEMD_NSS_RESOLVE_NETWORK
71 Takes a boolean argument. When false, answers will be returned
72 without using the network, i.e. either from local sources or the
73 cache in systemd-resolved.
74
76 Here is an example /etc/nsswitch.conf file that enables nss-resolve
77 correctly:
78
79 passwd: compat systemd
80 group: compat [SUCCESS=merge] systemd
81 shadow: compat systemd
82 gshadow: files systemd
83
84 hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
85 networks: files
86
87 protocols: db files
88 services: db files
89 ethers: db files
90 rpc: db files
91
92 netgroup: nis
93
95 systemd(1), systemd-resolved(8), nss-systemd(8), nss-myhostname(8),
96 nss-mymachines(8), nsswitch.conf(5), systemd.syntax(5)
97
98
99
100systemd 250 NSS-RESOLVE(8)