In most of the case, Internet Service Providers providing the DNS servers to the customer. User can change it, the reasons to switch to other DNS servers for performance, privacy and censorship. Most of the people using OpenDNS as the first alternative, But Now Google Public DNS is available and the performance is much better.
Now How to set up Google Public DNS in Ubuntu
Select System-->Preferences-->Network Connections
Select the type of connection you have. For this example, we will use ‘Wired’.
Under ‘Wired’, highlight ‘Auto etho’ and click on ‘Edit’.
Now, Inside 'Editing Auto etho' window, click on ‘IPv4 Settings’ tab. and select 'Automatic (DHCP) address only'
Put these nameserver addresses as your ‘DNS Servers’:8.8.8.8, 8.8.4.4
Click ‘OK’ and reboot your machine.
NOTE:
For avoiding your settings get revoked after reboots, you may need to make the following changes via the command line:
$ sudo cp /etc/resolv.conf /etc/resolv.conf.auto
$ gksudo gedit /etc/dhcp3/dhclient.conf
# append the following line to the document
prepend domain-name-servers 8.8.8.8, 8.8.4.4;
# save and exit
$ sudo ifdown eth0 && sudo ifup eth0