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 126.96.36.199, 188.8.131.52;
Save the file (CTRL+X) and reboot. Now you’re using the chosen DNS (Google DNS if you used the ones listed above).