Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been using the hosts file to for local website development, and it's recently stopped working. No entries other than localhost resolve.

I've simplified to test, so it now contains only  localhost
::1        localhost

localhost responds to ping, does not.

  • The file is called hosts with no extension
  • It has no trailing spaces
  • It's saved in C:\WINDOWS\System32\drivers\etc which matches the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath
  • Oddly, despite UAC being on, I can edit, delete and save the file without admin permissions
  • No proxy is being used, PC is not connected to network for testing
  • Stopping the DNS Client service seemed to resolve the issue for a few minutes, briefly resolved but doesn't any more.
  • Only firewall is Windows'
  • Machine has been restarted.

Is there anything else I should try?

share|improve this question

Avoid multiple entires for the same IP — write multiple hostnames on the same line (with the first being the canonical name). e.g.: localhost localhost.localdomain

::1 localhost localhost.localdomain

If you’re still having problems, try (from a command prompt):

net stop dnscache

share|improve this answer
The first part of this does seem to have worked! Many thanks. – e100 May 6 '10 at 10:18
Hmm, without any further changes to hosts, again does not resolve. The DNS Client service is disabled. Seems there's another issue here. – e100 May 10 '10 at 12:26
when you say “does not resolve” do you mean a ping from the command-line fails, or are you testing a different way? (Also, might be worth removing the from the ::1 line — if you're not properly set up for IPv6, it might confuse matters having it there). – Mo. May 10 '10 at 12:31
ping from command line now fails, with or without ::1 – e100 May 10 '10 at 12:44
okay, something else is going on somewhere, though I must confess I’m not sure what it might be — your hosts file is present (and correct as far as I can assume), the DNS caching service isn’t getting in the way to confuse matters. I’m a bit stumped. – Mo. May 10 '10 at 13:56

Try this:

# localhost
::1 localhost

share|improve this answer
Still does not resolve – e100 May 5 '10 at 17:09

Have you tried either removing the line:

::1        localhost

or adding the line:



There used to be issues in the past if the hosts file contained spaces rather than tabs between the address and the name. I haven't checked recently enough to know whether that's still the case. You could try making sure that the delimiter is a tab rather than spaces.

share|improve this answer
Yes and yes, with no effect, but isn't that entry for IPv6 compatibility? – e100 May 5 '10 at 16:45
@elliot100 - I think so, I was just trying to suggest that you make the version that doesn't work identical to the version that does. – ChrisF May 5 '10 at 18:43
up vote 0 down vote accepted

Having tried everything suggested here, I resolved the issue by reinstalling Windows.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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