0

My question is essentially the same as Why doesn't systemd-resolved use my local DNS server?, but I'm looking for a different kind of answer. The basic question has been asked many times, but the answers that I have found so far have always been a variation of "this is how you stop systemd from doing its thing, and allows you to to it manually, which will make it work as expected.".

I'm more curious about whether it is possible to get systemd to actually use the local (primary) dns, and only go to second, third, etc dns if the primary one fails?

It sort of behaves like it assumes that all DNS's are equal, so rather than use the first one offered by the dhcp it chooses another one that it prefers and sticks with that one instead.

This breaks a common configurations where organizations have a local dns for their private lan names. It seems downright bizarre that systemd's resolver wouldn't be able to handle such a common configuration -- so bizarre that I don't believe it to be the case.

Rather than just disabling it -- is there a way to get it to understand that it should be using the first dns given to it in the dhcp reply?

1 Answers1

0

No, and it's most likely using your local dns by default anyway. Systemd will query in the order of configured DNS. If you have one configured from the network via dhcp it'll use that one. Systemd however thinks that all DNS servers are equal so will fail to the next server in the list if there's an issue and not retry from the top which is different from resolv.conf behavior, which doesn't remember failed servers and retried in order all the time.

From what I've seen in most cases this is a problem because people put a server at the top that only servers their local domain and fails on, say google.com and their local one is not tried anymore. Which seems to be the case in the question you linked to.

You can do:

resolvectl query -i ethX  <domain>

To check that the dns server on that interface responds correctly. -i will use the DNS server configured on that interface which can be seen from status.

Including the output from your specific resolvectl settings would help if you have a specific problem. The laptop i'm writing this from is using resolve without modification and resolving from my router's DNS server though.

Livinglifeback
  • 1,586
  • 10
  • 16