How to configure your dns in the right way on Ubuntu desktop and server

hello everyone,
I have had a problem on my server and I am sharing it because I wish that nobody faces this problem. it is really painful to deal with the DNS resolver on ubuntu server.
after uninstalling pi-hole my server was unable to resolve DNS names like you would be able to ping 8.8.8.8 but you wouldn’t be able to ping google.com which is mean your system is not able to resolve the DNS and here is how you fix it.
1- go to this file
sudo nano /etc/resolv.conf
2- add this line
servername 1.1.1.1
3- you also need to add it to this file so the system recognize it
sudo nano /etc/resolvconf/resolv.conf.d/tail
4- restart your system
5- you have solve a problem that the designer of the dnsresolver of the linux operating system was straggling with " He actually said that "

Thank you for reading
I am posting this for future reference and because I always mess up my system.

1 Like