Hello!
So I just installed Ubuntu Server 12.04 on my machine. I have the web server and SSH server working, you can acces both from the internet. However, every time I attempt to run update or upgrade commands from SSH, it fails to do so, resulting in a similar error as when you try to update/upgrade while not connected to the internet. It is connected to the internet though because I can access the site from the web and I can connect to the SSH server. I looked at the sources.list file and it is as it should be. I also enabled all outbound ports from UFW. Any suggestions? thanks!

i needed to set the dns nameserver in /etc/network/interfaces!
you need to append 'dns-nameservers 192.168.1.1' or your router's ip address to the end of the description of the static ip! then /etc/init.d/networking restart and it works!!!