I'm on Ubuntu 22.04

I've set some custom DNS servers in /etc/systemd/resolved.conf (systemd-resolved)

I'm also using NetworkManager.

The servers set in /etc/systemd/resolved.conf are and

Now the output of sudo resolvectl status looks like:

         Protocols: -LLMNR -mDNS +DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: stub
Current DNS Server:
       DNS Servers:

Link 2 (enp8s0)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS +DNSOverTLS DNSSEC=no/unsupported
Current DNS Server:
       DNS Servers:

How can I make the DNS servers for the enp8s0 interface (which come from DHCP) disappear or show the ones in the global section?

I've tried multiple solutions so far (for example setting ignore-auto-dns like: nmcli conn modify "WiredETH" ipv4.ignore-auto-dns yes and nmcli conn modify "WiredETH" ipv6.ignore-auto-dns yes), but none change the output of sudo resolvectl status for this interface.


1 Answer 1


Write the dns configuration to /run/systemd/resolve/stub-resolv.conf as recommended in the Arch Linux wiki. Then create the symlink.

sudo ln -rsf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
sudo systemctl restart systemd-resolved.service
  • This is strange, now with nmcli conn modify "WiredETH" ipv4.ignore-auto-dns yes and nmcli conn modify "WiredETH" ipv6.ignore-auto-dns yes or the same thing from GUI - turning off automatic DNS for the interface, the DHCP DNS servers no longer appear in the resolvectl output. Maybe it's because now, besides restarting the network services after the change, I'm also disabling and reenabling the interface. If I still get issues with my method will try your suggestion. Thanks!
    – Soren G.
    Feb 17, 2023 at 13:39
  • You should write the DNS configuration to /run/systemd/resolve/resolv.conf, not the stub.
    – parsley72
    Mar 29, 2023 at 2:20
  • @parsley72 Please read the documentation linked in the answer.
    – GAD3R
    Apr 12, 2023 at 16:31
  • I don't see where in this doc it is recommended to write the dns conf to this file. Could you point to it? Rather, this file seems to be managed by systemd-resolved. I understand this file is dynamic and points to the internal DNS stub server, that in turn can be configured manually as described here : wiki.archlinux.org/title/systemd-resolved#Manually. In my understanding you should not edit this file at all.
    – bastian
    May 15, 2023 at 22:27
  • @GAD3R how to achieve the same for some other configuration like mdns ? resolved.conf only modifies global settings not per interface settings. systemd-resolve --set-mdns works but it doesn't persists accross boot ? May 27, 2023 at 8:58

You must log in to answer this question.

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