If you cannot ping any websites and cannot get updartes or upgrades, you might have a nameserver issue. GI just installed a fresh copy of Ubuntu Server 12.04 and this has been an issue since I installed it. I did not know what to do, but I check the /etc/resolv.conf file and it was totally blank. The format for this should be (as a sample)
search mysite.biz
nameserver ROUTER
nameserver OTHER ROUTER
You might need to tweak this a bit, I just wrote the same router twice. Save the file, exit and voila! Internet connection again!

Dani AI

Generated

Good catch by — a blank or short-lived /etc/resolv.conf on a fresh Ubuntu 12.04 install is usually the resolvconf framework doing its job: the file is dynamically generated and manual edits are overwritten. That explains why a quick edit can restore connectivity temporarily but the change disappears after a reboot or network restart. (manpages.ubuntu.com)

How resolvconf populates DNS: it collects nameserver info from DHCP client hooks, from NetworkManager (desktop) and from ifup/ifdown static settings. For static interfaces the supported method is to supply dns-* options in the interface stanza (this is the same approach mentions). In mixed setups a DHCP-provided server can still take precedence, so ordering and override strategy matter. (people.canonical.com)

Persistent alternatives and practical notes that weren’t in the thread: resolvconf will include whatever is in /etc/resolvconf/resolv.conf.d/* (head, base, tail) so putting always-needed server entries into the appropriate file makes them survive regenerations; after editing, trigger resolvconf to rebuild the resolver state. When DHCP controls an interface the dhclient.conf options (prepend/supersede domain-name-servers) or a dhclient hook can be used to keep DHCP from clobbering chosen servers. Quick checks and refresh commands commonly used are shown below.

ls -l /etc/resolv.conf
sudo resolvconf -u

(stgraber.org)

Troubleshooting checklist (concise): confirm the system has resolvconf installed and that /etc/resolv.conf is a symlink to the resolvconf-managed file; prefer editing resolvconf’s template files or dhclient.conf over hand-editing /etc/resolv.conf; be aware NetworkManager/dnsmasq can introduce 127.0.0.1 as a resolver entry on desktops; and note that upgrades to resolvconf on Precise historically dropped static entries unless they were migrated into the resolvconf-managed files. (manpages.ubuntu.com)

as an update, this file is SUPPOSED to be blank and is only used for non-static machines. it is automatically overwritten a every restart. to permanently fix this, edit /etc/network/interfaces and add the line 'dns-nameservers 192.168.1.1' or whatever you router ip happens to be, and save the file. restart networking '/etc/init.d/networking restart' and voila! internet!

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.