For most users the DNS servers provided by their ISP may suffice, but some user may need DNS that are faster, safer and with far fewer restrictions for online browsing.
To change the DNS servers in Ubuntu, you need to modify the file ‘dhclient.conf’.
Open the terminal and give the following command:
sudo nano /etc/dhcp/dhclient.conf
Then uncomment the line below and add the DNS you want:
prepend domain-name-servers 188.8.131.52, 184.108.40.206;
Save the file (CTRL+X) and reboot. Now you’re using the chosen DNS (Google DNS if you used the ones listed above).