In RHEL 8, systemctl list-unit-files|grep resolved reports that systemd-resolved is both present and running by default. However, systemd-resolve --statistics shows no name:ip mappings are being cached locally: caching statistics remain "0" even when I force resolution doing something with ping www.redhat.com or systemd-resolve www.redhat.com

Why is resolved not caching previously resolved name:ip mappings locally?!?!?

Caching tests annotated screenshot PRE changes


The fix is simple: you need to reference resolved as a source of DNS resolution in /etc/nsswitch.

Add "resolve" to the hosts directive, making it first in the list. So the hosts entry in /etc/nsswitch should look as below:

hosts:      resolve files dns myhostname

Let's see what happens after we make the change to /etc/nsswitch:

Caching tests annotated screenshot POST Changes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.