I'm using Kubuntu 18.04. When I'm in the office network, everything works fine, but when I connect to any other network (wired of wifi) I don't get proper DNS names - the old ones are still in systemd-resolve --status output. When I add the proper DNS address via systemd-resolve --set-dns= --interface=eno1, the problem is solved temporarily and I can resolve hostnames, but after a while it stops working and I have to run the --set-dns again.

How do I solve this?

  • If I had to guess, I would say you have hardcoded DNS servers in your configuration. – Rui F Ribeiro Aug 8 '18 at 10:51
  • @RuiFRibeiro - where can I look for them? I already checked /etc/NetworkManager/NetworkManager.conf and /etc/systemd/resolved.conf - no mention of them – Mirek Aug 8 '18 at 10:58
  • Check /etc/resolv.conf in the "working" and "not-working" cases. Is it the same or different? Also check the Arch Wiki page on systemd and alternatives to systemd-resolvconf – Mark Stosberg Aug 8 '18 at 18:10

The answer turned out to be brutal and simple. The DHCP client was superseding the DNS entries in /etc/dhcp/dhclient.conf via supersede domain-name-servers ...,...;. I have no idea why it was there, I must've forgot that I've set this a while back.

The command that saved me:

sudo find /etc -type f -print0 2>/dev/null | xargs -0 sudo grep "<hardcoded address>"

Yep, simple as that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.