Hacker News new | ask | show | jobs
by lawaaiig 643 days ago
I recall systemd-resolved ignoring the resolv.conf order of preference of name servers. The native and thus relatively simple per-link DNS configuration is great though.

Addendum: https://news.ycombinator.com/item?id=15228940 This approach clearly deviates from widely expected behavior, whether it is in conformance with applicable RFCs or not.

1 comments

Resolv.conf does not specify order of preference of name servers! All the servers configured here are supposed to return the same answers!

See, many people have misconceptions how it works; see the comments in thread you linked to. Add to it the fact that resolv.conf syntax cannot express what is expected of modern resolvers (not even with apple-like extension - `/etc/resolver/*`; it cannot react to links going up and down), it is basically just compatibility shim for broken applications (they are not supposed to use it directly); that's why systemd-resolved configures it to point to itself and handles the specifics for them.

Providing the same answers does not preclude an order (of preference). The man page clearly shows that such an order exists, though it does not explicitly label it as a preference. Whether you think it's right or wrong is irrelevant—the fact remains that the expectation of querying DNS servers in a specific order has been a common understanding for many. You're free to think systemd-resolved is the right way forward, but that's not an argument against the existence of the ordering in resolv.conf.
> the fact remains that the expectation of querying DNS servers in a specific order has been a common understanding for many.

That understanding has been wrong; it is an implementation detail of glibc and that's it. It could query them in random order, or round-robin them for each request; or time them how fast they respond and prefer the fastest, up until it starts timing out and then shake the order again. Some resolver stubs ask all of them and use the answer that arrives first. That's also valid. Since they all are returning the same answer, it doesn't matter. It also makes any argument for ordering superfluous.

So that "common understanding for many" is erroneous and those many should update it. The thread you linked to has exactly a discussion on this point, so in the years that passed since then, those affected many had ample time to fix up their assumptions.

That understanding is in line with using libresolv and the established behavior of the resolv.conf file, which accompanies the libresolv library. While it’s true that different implementations (e.g., some resolver stubs) might use various methods like round-robin, timing, or querying all servers simultaneously, this doesn’t invalidate the behavior outlined in resolv.conf.

Again, there can be other valid reasons for maintaining an order. Could be about latency, privacy etc.

I admit to not having read the full thread, and I apologize for any needless rehashing of arguments. It was just the first result confirming systemd-resolved breaking setups by its handling of what many (in that thread) consider expected behavior.

What I think you're primarily suggesting is that there are no formal standards prescribing glibc's behavior in terms of DNS resolution order. That is certainly true, and I don't disagree calling it an implementation detail.