NSS-RESOLVE(8)

NAME
nss-resolve, libnss_resolve.so.2 - Provide hostname resolution via systemd-resolved.service

SYNOPSIS

libnss_resolve.so.2

DESCRIPTION

nss-resolve is a plug-in module for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) enabling it to resolve host names via the systemd-resolved(8) local network name resolution service. It replaces the nss-dns plug-in module that traditionally resolves hostnames via DNS.

To activate the NSS module, add "resolve" to the line starting with "hosts:" in /etc/nsswitch.conf. Specifcally, it is recommended to place "resolve" early in /etc/nsswitch.conf' "hosts:" line (but after the "files" or "mymachines" entries), right before the "dns" entry if it exists, followed by "[!UNAVAIL=return]", to ensure DNS queries are always routed via systemd-resolved(8) if it is running, but are routed to nss-dns if this service is not available.

EXAMPLE

Here is an example /etc/nsswitch.conf file that enables nss-resolve correctly:

    passwd:         compat mymachines systemd
    group:          compat mymachines systemd
    shadow:         compat
    hosts:          files mymachines resolve [!UNAVAIL=return] dns myhostname
    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)