To enable NetworkManager’s feature to start dnsmasq and enable dns caching:

  1. Add the following dns= line to /etc/NetworkManager/NetworkManager.conf:

  2. Install dnmasq:

    sudo dnf install dnsmasq
  3. Add some extra space to the default cache:

    sudo sh -c 'echo "cache-size=1000" >> /etc/NetworkManager/dnsmasq.d/cache.conf'
  4. Restart NetworkManager:

    sudo systemctl restart NetworkManager
  5. Observe the difference:

    for i in 1 2 ; do \time -f "Attempt $i: %E" nslookup <unvisited_domain> >/dev/null;  done

    Note: if you already have a caching resolver on your network, the impact will probably be minimal.

- Mike