We prefer Google Public DNS for Ubuntu Server.
Changing Nameserver
Below are steps to get it/
Open /etc/resolv.conf
file and paste following lines in it:
nameserver 8.8.8.8
nameserver 8.8.4.4
Remove/comment out any existing lines. That’s it. 🙂
Testing
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.