http://askubuntu.com/questions/135932/apt-get-update-failure-to-fetch-cant-connect-to-any-sources Yes, the name server update does work and if it does work then you've probably updated your IP settings to be static and your server can no longer resolve URLs.
Try the above and if it works, reboot. If it fails after rebooting, then do this:
Edit the template file for the resolv.conf. Ubuntu server rebuilds this every boot.
sudo vi /etc/resolvconf/resolv.conf.d/tail
- add just these two lines >>
nameserver 188.8.131.52 nameserver 184.108.40.206
Then save the file and restart the service:
sudo /etc/init.d/resolvconf restart
220.127.116.11 and 18.104.22.168 are just Google's Name Servers. You should be able to add in your own ISP's if you want. If you don't like vi, use nano or vim.
I figured it out reading this article. So credit to them for the tip.