How can I disable systemd-resolved in Ubuntu 17.04?
Disabling it with systemctl disable
didn't work, the service seems to be restarted (by Networkmanager?)
How can I disable systemd-resolved in Ubuntu 17.04?
Disabling it with systemctl disable
didn't work, the service seems to be restarted (by Networkmanager?)
This method works on the Ubuntu releases 17.04 (Zesty), 17.10 (Artful), 18.04 (Bionic), 18.10 (Cosmic), 19.04 (Disco) and 20.04 (Focal):
Disable and stop the systemd-resolved service:
Then put the following line in the
[main]
section of your/etc/NetworkManager/NetworkManager.conf
:Delete the symlink
/etc/resolv.conf
Restart NetworkManager
Also be aware that disabling systemd-resolvd might break name resolution in VPN for some users. See this bug on launchpad (Thanks, Vincent).
If you are using Ubuntu 18.04 Server (or Ubuntu 20.04 Server), none of these answers apply. The one by user2427436 comes closest.
The issue is that systemd-resolved is/runs a stub resolver, and I just need to completely disable that (per the question). I need to do this because Zimbra 8.8.15 (FOSS) comes with its own integrated resolver (unbound).
In my situation I am starting from a stock (naive) install of server 18.04, with minimal options on bare metal (well, actually a VM).
so here's the recipe:
This is what /etc/systemd/resolved.conf looks like now:
that's all it took.
Feel free to install any other resolver you want after this.
I've recently upgraded to (k)Ubuntu 17.04 and I also stumbled upon the change to systemd.
My setup is fairly typical I think, in that I have a DNS provider in my broadband HUB and this is my primary source of information for all the devices on my network (of which I have a few).
There is some beauty in systemd, it's not all bad but what is really bad is the documentation, the lack of communication from the Ubuntu team and the gung-ho "let's just change it despite it breaks for everyone" mentality.
The solution for me after tearing some hair out was to edit /etc/systemd/resolved.conf:
After not understanding why this wouldn't work I figured out that what was also needed was to switch
/etc/resolv.conf
to the one provided by systemd. This isn't the case in an out-of-a-box install (for reasons unknown to me).The local DNS server is then not used and all DNS requests are sent to my HUB.
I think this is a much better solution than cutting out and putting in some other solution since systemd-resolv is now the default onwards.
A related problem btw is that the
/etc/nsswitch.conf
is neutered.It should read:
This is a confusing configuration since
[NOTFOUND=return]
means processing ends there. The entries after it will never be used.If you are having leaks issues with your VPN and can't figure out how to set up systemd (like me) you can remove it in the way described in the first answer but don't add the
dns=default
line because it will activate the nameserver 127.0.0.1. To set the router as dns, create the file "tail" in your/etc/resolvconf/resolv.conf.d/
folder adding the linenameserver 192.168.1.1
do
ln -sf /var/run/resolved/resolv.conf /etc/resolv.conf
if you had messed up with this file.I feel compelled to add this excellent answer appearing on a dupe, it covers the case where you want the minimal setup of ifupdown + dhclient + resolvconf (yes this is still possible in 2021 in Ubuntu Focal).
This use case isn't covered by the other answers. Maybe we should strive to provide non-systemd-resolved setups for most of the different combinations we could want in our networking stack (netplan-based, networkmanager-based, wicd, and so on).
https://askubuntu.com/a/1336755/32178