SystemD’s implementation of resolved works well enough if you don’t have a lab or internal DNS servers like I have. I have found that it is easiest to manage DNS on Ubuntu if you disable resolved entirely. This post will show you how to turn off systemd-resolved.
If you run your own lab environment then you most likely have your own DNS servers running.
Ubuntu Server comes with SystemD which manages our DNS server list for us but in my experience it always has problems when you have your own local DNS servers.
In addition, Ubuntu comes with NetworkManager which attempts to make managing our DNS server list easier.
In this post we will disable both SystemD-ResolveD and we will tell Network Manager not to manage our DNS server list.
This means that when we edit /etc/resolv.conf our edits will stick after a reboot.
Turn off systemd-resolved
Run the following commands to disable the resolved service:
# systemctl disable systemd-resolved # systemctl stop systemd-resolved
Remove the symlinked resolv.conf file
# rm /etc/resolv.conf
And finally create your new resolv.conf file
# emacs /etc/resolv.conf
Add in your DNS servers and search domain:
nameserver 192.168.0.2 nameserver 192.168.0.3 search admintome.home
Save the file and you’re done.
Stop Network Manager DNS Management
Next open and edit /etc/NetworkManager/NetworkManager.conf.
Add this line under the [main] section.
Save and exit the file.
You now know how to turn off systemd-resolved and NetworkManager from messing with your static DNS servers.!
For more great article checkout AdminTome Blog.
I hope you have enjoyed this article, if so please leave a comment below. For more articles, please signup for the AdminTome Blog below. Also please feel free to share the article to your friends using the buttons to the left. Thanks again for reading this post.