There's a warning that resolv.conf is managed outside it. That all changes will be overwritten. You didn't say which version of Ubuntu Server you are running, so I have to guess it is recent. To prevent resolv.conf from being modified, you need to disable systemd-resolved. Wouldn't hurt to stop it first, disable it, then purge it from the system. Also, you want to understand symbolic links, since /etc/resolv.conf is usually a symbolic link to the real file elsewhere on the box. That isn't necessary if you are overriding the DNS completely. A normal file will work fine. I don't think anything is too picky about ownership, group or permissions, but these are what definitely work:
Code:
-rw-r--r-- 1 root root 74 Feb 28 2023 /etc/resolv.conf
Or if you want to keep the local DNS caching server, systemd-resolved, running, you can modify the config file for that tool. Just look for resolved.conf on the system.
Code:
$ locate resolved.conf
/etc/systemd/resolved.conf
/usr/lib/NetworkManager/conf.d/10-dns-resolved.conf
/usr/share/man/man5/resolved.conf.5.gz
/usr/share/man/man5/resolved.conf.d.5.gz
That's on my 22.04-based system. Yours could be different. It is self-documented and there is a manpage for it if you need more details.
If you are going to run a server, learning some basics would be useful. https://www.linuxcommand.org/tlcl.php has them. Start from chapter 1 and go through to first 250-ish pages (finish that chapter). Then you'll be safe enough to google answers.
Bookmarks