resolv.conf is the configuration file for DNS resolvers for all Linux distributions, including Debian, Mint, Ubuntu, RedHat, CentOS, etc. Usually we change the DNS resolvers list by editing resolv.conf. However, depends on your dhcp client configuration, resolv.conf may be rewrite after reboot. Without deep Linux experience, setting customs DNS servers on Linux maybe time consuming. But one thing we can do is make /etc/resolv.conf immutable to other program after you changed it. This will be the easier setup with no side effects on system.
Change the DNS server
Below example we will set DNS resolver to 184.108.40.206. (220.127.116.11 is a privacy-first consumer DNS service provided by Cloudflare.)
sudo echo 'nameserver 18.104.22.168' > /etc/resolv.conf
Run the chattr +i command to sets the immutable filesystem attribute on resolv.conf, so it can't be modified any anyone else.
sudo chattr +i /etc/resolv.conf
Reboot your system and test if your change to DNS server succeed. You can test it via DNS leak test.
If you want to make change to resolv.conf again, you need to remove the attribute.
sudo chattr -i /etc/resolv.conf
Some free public DNS server list:
Google Public DNS
22.214.171.124 / 2001:4860:4860::8888
126.96.36.199 / 2001:4860:4860::8844
188.8.131.52 / 2620:0:ccc::2
184.108.40.206 / 2620:0:ccd::2
Comodo Secure DNS
Verisign Public DNS
Cloudflare DNS Resolver