We prefer Google Public DNS for Ubuntu Server.
Below are steps to get it/
/etc/resolv.conf file and paste following lines in it:
nameserver 18.104.22.168 nameserver 22.214.171.124
Remove/comment out any existing lines. That’s it. 🙂
ping any domain/hostname. If you get “Failed to resolve host:” error, then there is something wrong in network configuration (apart from DNS).
Note: You can always ping IP address even if your machine do not any have nameserver entries or nameservers are down.