Score:1

My local DNS is continuously changed

hu flag

At home I run a Raspberry Pi with PiHole. Every device obtain its IP via DHCP and some devices have a reserved address. The router is configured to offer my Raspberry Pi as primary DNS, for every device this works well, except for my laptop with Ubuntu.

Quite often (like every day) my DNS is changed to my second DNS option. I can revert this change with resolvectl dns <interface> <ip>, but IMHO this should not happen. If I assign a primary DNS, it should be the one used, not matter what, unless it cannot be reached.

What could be the reason for having Ubuntu changing my primary DNS?

Update:

This is what the logs says about the automatic change. Aparently, there is no reason to pickup the second DNS over the first.

enter image description here

in flag
Your networking logs should have the answer to that question. The system will not do something like this without logging the reason for it
user10489 avatar
in flag
You could hard code the desired DNS entry in netplan probably. See https://askubuntu.com/questions/1383165/nameserver-goes-missing-from-etc-resolv-conf/1383180#1383180
hu flag
@matigo, I have added the logs with the change. I do not see in the logs any reason for the preference of my second DNS over the first. If you have a suggestion for a different search on the logs, please let me know.
hu flag
@user10489. Thanks, but that is not the point of my question.
user10489 avatar
in flag
Please read the answer I linked. netplan, network manager, and systemd all mess with resolv.conf unless you either disable it or configure what you want through one of those.
hu flag
@user10489. I read the answer, but my question is "why my DNS of preference, as indicated by DHCP, is not respected". I do not want to make an exception with my laptop and hardcode the DNS, the rest of the network is using my first DNS, except Ubuntu. I want to understand why.
user10489 avatar
in flag
Likely it is using the local caching dns server, which is itself using one or both of the DNS servers provided by dhcp.
Felipe avatar
au flag
I'm experiencing the same problem with Ubuntu 22.04 but I don't have those lines in my logs. Sadly this is driving me insane! My router doesn't have hairpining, so I rely on DNS to reach the local server and if Ubuntu decides to switch it, then many of my services are gone.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.