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!

Dani AI

Generated

Nice catch, — that symptom is classic: inbound TCP (HTTP/SSH) can work while outbound DNS is missing, so apt (which contacts mirror hostnames) fails and reports what looks like a “no network” error. The real problem is the resolver (what fills /etc/resolv.conf) not being populated after you set a static IP.

Quick checks to run on the server:

ping -c3 8.8.8.8                # verify basic IP routing/gateway
ping -c3 archive.ubuntu.com     # see if DNS name resolution works
cat /etc/resolv.conf           # look for 'nameserver' lines
nslookup archive.ubuntu.com 8.8.8.8  # test DNS using a known public server
sudo apt-get update            # reproduce the apt error

Immediate and persistent fixes to consider:

  • Temporary: add a working nameserver to /etc/resolv.conf to get apt going (note: this file may be overwritten).
  • Persistent: use the system resolver management (resolvconf) or make your static-interface configuration provide nameserver information so resolvconf updates /etc/resolv.conf on bring-up. If resolvconf is installed you can place permanent entries into /etc/resolvconf/resolv.conf.d/head and run resolvconf -u.
  • If DNS still fails after those changes, check upstream blocking of UDP/TCP port 53 (router/ISP or firewall rules) and use packet capture (tcpdump) to observe DNS queries/replies.

Summary: ’s resolution (adding the DNS information for the static address so the resolver is populated) is the correct approach. The diagnostics above will confirm whether the issue is DNS vs. true routing, and the persistent-resolvconf or interface-based solution will keep apt working after reboots.

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!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.