I've installed 19.04 and removed dsnmasq, disabled systemd-resolve using

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved

and want to use Network Manager to set manually my DNS servers. Now I want to configure a different DNS server, so I went to the network icon on the bar and clicked Wired -> Wired Settings -> Configure -> IPV4, select Automatic (DHCP) and disable DNS as automatic, putting my desired DNS servers. Even after rebooting, my /etc/resolv.conf file now only gets, not matter what I do on the Nettwork Manager configuration. Is there a way for the /etc/resolv.conf file to be configured by Network manager?

  • Yes... sigh... quit disabling parts of your OS. /etc/resolv.conf should show make sure that the /etc/resolv.conf symlink is intact. reinstall dnsmasq-base. re-enable and start systemd-resolved. Use resolvectl or systemd-resolve --status to check your DNS configuration.
    – heynnema
    Jul 18, 2019 at 14:23
  • Thanks, but no thanks. I have a local DNS resolver that I want to use directly, without any caching by the OS. I don't want systemd to resolve DNS for me.
    – Ivan
    Jul 18, 2019 at 14:35
  • But... how do you expect your system to resolve ANY DNS when you disable the two services that do that?
    – heynnema
    Jul 18, 2019 at 14:42
  • 1
    Incredibly, removing both systemd-resolve and dnsmasq and configuring the DNS server with the old fashioned /etc/resolv.conf using Network Manager works as expected. See my answer below.
    – Ivan
    Jul 18, 2019 at 14:45

1 Answer 1


I've found a solution.

First, disable systemd-resolve:

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved

Remove the symlink for resolv.conf and create a file:

rm -rf /etc/resolv.conf
touch /etc/resolv.conf
chmod a+rw /etc/resolv.conf

Now change the configuration file for Network Manager to restore the expected result: vi /etc/NetworkManager/NetworkManager.conf:

# add this line

and leave the rest of the file as is. Restart Network Manager:

sudo /etc/init.d/network-manager restart

and configure your preferred DNS servers. Done!

  • A more standard way to do this... without disabling services... or modifying the /etc/resolv.conf symlink... is to edit /etc/systemd/resolved.conf and change the #DNS=` line...
    – heynnema
    Jul 18, 2019 at 14:49
  • 1
    And change to what, exactly? Can you provide some documentation about how this configuration would follow what is configured in NM? See, I don't want to hardcode DNS servers on files, I want to configure DNS per connection using NM.
    – Ivan
    Jul 18, 2019 at 14:49
  • #DNS= becomes DNS= Change the DNS addresses to your own. Or do it as you suggest... individually via NM GUI.
    – heynnema
    Jul 18, 2019 at 14:51
  • Yeah, that's my point. I don't want to hardcode to some DNS because I'm configuring a laptop. When I'm in some places I want to use some specific DNS, when in others I want to use DHCP to provide DNS for me. If I hardcode the google DNS I'll be always using it. My solution seems to make it work the way I want it.
    – Ivan
    Jul 18, 2019 at 14:52
  • 1
    fwiw I have the same use case as Ivan, and I have not been able to make systemd-resolved cohabit with NetworkManager by editing resolved.conf as suggested. Disabling the service works however.
    – TTimo
    May 1, 2020 at 21:54

You must log in to answer this question.

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