7

When I type in "google.com," firefox tells me that the server is not found. When I type in the IP address of google, it works just fine.

I was playing with this computer at another place and it didn't have any problems.

I have no idea what's wrong.

Also: this is a fresh install and the computer is a little old.

13

The configuration file /etc/resolv.conf contains information that allows a computer connected to a network to resolve names into addresses.

Change it to, for example, Google's DNS servers:

nameserver 8.8.8.8
nameserver 8.8.4.4

Also check that your dhclient is activated.

  • Just curious: what gave it away? What caused it? – anonymous May 21 '12 at 4:22
  • 1
    It's the first thing to check, after basic network connectivity, when diagnosing DNS resolution problems. The fact you were "playing with this computer at another place" without problems suggests a misconfigured DNS resolver, which is done in /etc/resolv.conf on UNIX-like systems. It's likely that previously, the machine was configured to use a private DNS resolver only available to machines on a specific network. – D_Bye May 21 '12 at 9:21
  • 1
    Remember if the machine is configured to use DHCP, resolv.conf may well get replaced at the next reboot. You need to make sure DHCP (if in use) is configured correctly, and your local DHCP server (usually your cable / adsl modem) is handing out the right details. – EightBitTony May 21 '12 at 21:58
  • 1
    8.8.8.8 is the Google public name server. 8.8.4.4 is the secondary. You should probably add both. – Swiss May 22 '12 at 5:41
11

Your problem sounds like a case of not having the DNS server set. Normally, you would want to edit /etc/resolv.conf, but in Debian (and Ubuntu) this file could be overwritten. The official solution to this is to install the resolvconf package: apt-get install resolvconf

Then edit (with root permissions) either /etc/resolvconf/resolv.conf.d/head or /etc/resolvconf/resolv.conf.d/tail adding

nameserver 8.8.8.8
nameserver 8.8.4.4

and then run resolvconf -u to update the file. This will keep your changes from being overwritten.

1

You'll also find that the Name Service Switch (NSS) configuration file, /etc/nsswitch.conf is a common cause of this issue. While you can resolve addresses at the command line with ping and host commands, other commands like apt-get fail.

The solution is to change this line in /etc/nsswitch.conf:

From this:

hosts:          files mdns4_minimal [NOTFOUND=return] dns myhostname

To this:

hosts:          files dns

This should instantly fix the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.