1

I was reading about systemd-resolved and how it listens on 127.0.0.53 for DNS requests. What is the purpose of running this server and making queries to it when you could directly query a DNS server such as one from Google, Cloudflare, or your ISP instead?

4
  • Try: Link-Local Multicast Name Resolution. It's a pretty sane introduction that states right off the bat, what this is for. [TLDR: if you have a local link and want to resolve local names and private domains locally, this is the way to go...]
    – Cbhihe
    Mar 1, 2022 at 19:26
  • It also caches DNS responses, which should speed up repeated requests.
    – Panki
    Mar 2, 2022 at 9:39
  • If your ISP has a high-performance DNS service available, you may find the best of both worlds by running a local resolver and setting it to only forward queries (rather than initiating a full recursion of its own) when it has neither an authoritative nor a cached response available. This allows your system to benefit from the speed of your local cache when possible, and leverages the presumably substantial cache of your ISP when the local cache encounters a miss.
    – Jim L.
    Mar 2, 2022 at 21:04
  • @JimL. that’s exactly what systemd-resolved does. Mar 2, 2022 at 22:23

1 Answer 1

1

Running a local resolver (in general, not just systemd-resolved) can provide a number of benefits; typically, the first one is caching, since most local resolvers will cache responses to queries. This means that repeated queries will be handled faster.

Other benefits can be derived from the fact that the resolver is local, and therefore knows about your local environment (which external resolvers can’t). In systemd-resolved’s case, that covers:

  • a number of synthetic records, including localhost, _gateway, and any entries in /etc/hosts (so that applications get consistent resolution, whether they query using DNS directly or gethostbyname etc.);
  • hosts discoverable using link-local multicast name resolution (so that other systems on your LAN can be found through DNS);
  • hosts discoverable using multicast DNS, with a .local domain suffix (e.g. printers).

It can also enforce policies which only make complete sense locally, e.g. DNSSEC.

On top of that, systemd-resolved handles all name resolution services: DNS using its stub resolver, RFC-3493-style getaddrinfo/gethostbyname, and its own D-Bus interface, again ensuring a consistent experience for all clients, at least at the resolution level (it can’t solve variations arising from the use of proxies for example).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .